@bemoje/o-set-non-enum

1.0.1 • Public • Published

@bemoje/o-set-non-enum

Adds a non-enumerable property on an object

Version

NPM version

Travis CI

dependencies

Dependencies

dependencies

Stats

NPM downloads Forks

Donate

Buy Me A Beer donate button PayPal donate button

Installation

npm install @bemoje/o-set-non-enum
npm install --save @bemoje/o-set-non-enum
npm install --save-dev @bemoje/o-set-non-enum

Usage

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 test

API

Table of Contents

oSetNonEnum

Adds a non-enumerable property on an object

Parameters
  • o object The object on which to set a property value

  • key string The property key name

  • value string The property value

  • writable boolean Whether or not the property should be writable. (optional, default true)

  • configurable boolean whether or not the property should be configurable (optional, default false)

Returns void

Package Sidebar

Install

npm i @bemoje/o-set-non-enum

Weekly Downloads

5

Version

1.0.1

License

MIT

Unpacked Size

9.03 kB

Total Files

5

Last publish

Collaborators

  • bemoje