Wondering what’s next for npm?Check out our public roadmap! »

    jsets
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    jsets

    NPM version Build Status Coverage Status

    Define Getter and Setter

    Install 安装

    $ npm install --save jsets

    Usage 使用

    const jsets = require('jsets')
     
    let data = {}
    let instance = {}
    instance.set = jsets.createSetter(instance, function (name, value) {
      data[name] = value
    }, true)
    instance.get = jsets.createGetter(instance, function (name, value) {
      return data[name]
    }, true)
     
    instance.set('a', 1)
    instance.set({
      a: 1,
      b: 2
    })
    instance.get(function (b, a) {
      console.log(b, a) // 2, 1
    })

    License

    MIT © zswang

    Keywords

    Install

    npm i jsets

    DownloadsWeekly Downloads

    7

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • avatar