own-all

    1.0.0 • Public • Published

    own-all

    Turns inherited properties into owned properties.

    Returns a new object. Does not modify the original.

    Installation

    Requires Node.js 6.0.0 or above.

    npm i own-all

    API

    The module exports a single function.

    Parameter

    obj (object): The object which may possess owned and/or inherited properties.

    Return Value

    A new object which owns all of the properties, both owned and inherited, of obj.

    Example

    const ownAll = require('own-all')
     
    Reflect.ownKeys(ownAll({a: 1})) /*
    [
      'a',
      'constructor',
      '__defineGetter__',
      '__defineSetter__',
      'hasOwnProperty',
      '__lookupGetter__',
      '__lookupSetter__',
      'isPrototypeOf',
      'propertyIsEnumerable',
      'toString',
      'valueOf',
      '__proto__',
      'toLocaleString'
    ]
    */
     
    // If you only want enumerable properties, use `Object.keys()` etc:
    Object.keys(ownAll({a: 1})) // ['a']

    Install

    npm i own-all

    DownloadsWeekly Downloads

    24

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    2.93 kB

    Total Files

    4

    Last publish

    Collaborators

    • lamansky