JSPM

dprop

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7425
  • Score
    100M100P100Q123391F
  • License MIT

tiny util for making enumerable properties

Package Exports

  • dprop

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dprop) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.