1.0.1 • Published 6 years ago
@bemoje/o-set-non-enum v1.0.1
@bemoje/o-set-non-enum
Adds a non-enumerable property on an object
Version
Travis CI
Dependencies
Stats
Donate
Installation
npm install @bemoje/o-set-non-enum
npm install --save @bemoje/o-set-non-enum
npm install --save-dev @bemoje/o-set-non-enumUsage
import oSetNonEnum from '@bemoje/o-set-non-enum'
const o = {}
oSetNonEnum(o, 'key', 3)
Object.getOwnPropertyDescriptor(o, 'key')
/* => {
value: 3,
writable: true,
enumerable: false,
configurable: false,
}
*/Tests
Uses Jest to test module functionality. Run tests to get coverage details.
npm run testAPI
Table of Contents
oSetNonEnum
Adds a non-enumerable property on an object
Parameters
oobject The object on which to set a property valuekeystring The property key namevaluestring The property valuewritableboolean Whether or not the property should be writable. (optional, defaulttrue)configurableboolean whether or not the property should be configurable (optional, defaultfalse)
Returns void