New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

create-v-model

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-v-model

create v-model bindings quickly and easily - without having to remember which props to use

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
60
decreased by-10.45%
Maintainers
1
Weekly downloads
 
Created
Source

create-v-model

create v-model bindings quickly and easily - without having to remember which props to use

install

yarn add create-v-model
npm install --save create-v-model

use

import { modelProps, createModel } from 'create-v-model'

export default {
  props: {
    ...modelProps()
  },
  setup: (props) => ({
    model: createModel(props)
  })
}

api

modelProps

Provides all three props used in binding a standard v-model to a component

props: {
  ...modelProps({
    modelType: any,
    modelModifiersDefault: any
  })
}

modelType:

  • default: null
  • an optional type to specify the model should be

modelModifiersDefault:

  • default: {}
  • an optional alternative default for the modelModifiers prop

createModel

Creates a new computed that can be used as a standard ref and will reflect changes on v-model

setup: (props) => ({
  model: createModel(props)
})

createModifierModel

Same as createModel, but as a higher-order function which takes a modifier function and returns a createModel function

const myModifier = (val, modifiersObject) => modifiersObject.hello ? 'Hi ' + val : val
const modifiedModelCreator = createModifierModel(myModifier)

export default {
  setup: (props) => ({
    model: modifiedModelCreator(props)
  })
}

namedModelProps

Same as modelProps, but as a higher-order function which takes a name and returns a modelProps function

const createFooProps = namedModelProps('foo')

export default {
  props: {
    ...createFooProps()
  }
}

createNamedModel

Same as createModel but as a higher-order function which takes a name and returns a createModel function

const createFooModel = createNamedModel('foo')

export default {
  setup: (props) => ({
    fooModel: createFooModel()
  })
}

createNamedModifierModel

Same as createModifierModel but takes a name as the first argument instead of the modifier function

const myModifier = (val, modifiersObject) => modifiersObject.hello ? 'Hi ' + val : val
const modifiedFooModelCreator = createNamedModifierModel('foo', myModifier)

FAQs

Package last updated on 23 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc