Neonatal Penguin March

    prop-keys

    2.0.0 • Public • Published

    prop-keys

    Returns an array of the keys of all properties (owned and inherited) of an object.

    Installation

    Requires Node.js 6.0.0 or above.

    npm i prop-keys

    API

    The module exports a single function.

    Parameters

    1. Bindable: obj (object): The object whose property keys you want to get.
    2. Object argument:
      • Optional: own (boolean): If set to true, only the object’s “own” property keys are returned. If omitted or if set to false, both owned and inherited property keys are returned.
      • Optional: enumOnly (boolean): If set to true, only the keys of properties defined with the enumerable flag will be returned.

    Return Value

    An array of the keys of object properties.

    Example

    const keys = require('prop-keys')
     
    keys({key: 'value'}, {own: true}) // ['key']

    Related

    • prop-entries: Same as this module, except it returns key-value pairs.
    • prop-values: Same as this module, except it returns values.
    • keys-array: Supports more than just Objects.

    Install

    npm i prop-keys

    DownloadsWeekly Downloads

    25

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    3.36 kB

    Total Files

    4

    Last publish

    Collaborators

    • lamansky