dprop
tiny util for making enumerable properties
Last updated 12 years ago by mattdesl .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install dprop 
SYNC missed versions from official npm registry.

dprop

stable

Stupidly small utility for making enumerable and configurable getter/setter objects, because ES5 is annoying.

Before:

Object.defineProperties(obj, {
  foo: {
    configurable: true,
    enumerable: true,
    get: function() {
      return 'blah'
    }
  },
  bar: {
    configurable: true,
    enumerable: true,
    get: function() {
      return 'foobar'
    }
  }
})

After:

var getter = require('dprop')

Object.defineProperties(obj, {
  foo: getter(function() {
    return 'blah'
  }),
  bar: getter(function() {
    return 'foobar'
  })
})

Usage

NPM

dprop([get], [set])

Returns a { configurable: true, enumerable: true } object with the specified (optional) get and set functions.

See Also

  • d - a little more feature rich

License

MIT, see LICENSE.md for details.

Current Tags

  • 1.0.0                                ...           latest (12 years ago)

1 Versions

  • 1.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 5
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE