@kingjs/descriptor.create

Creates a descriptor.

Stats

StarsIssuesVersionUpdatedCreatedSize
@kingjs/descriptor.create
1.0.83 years ago3 years agoMinified + gzip package size for @kingjs/descriptor.create in KB

Readme

@kingjs/descriptor.create

Returns a descriptor given a primitive value.

Usage

var create = require('@kingjs/descriptor.create');

var people = {
  alice: { name: 'Alice', age: 21 },
  bob: 'Bob'
}

for (var name in people)
  people[name] = create(people[name], 'name');

people;

result:

{
  alice: { name: 'Alice', age: 21 },
  bob: { name: 'Bob' }
}

API

declare function create(
  value,
  action: string | (value) => Descriptor
): Descriptor

Interfaces

  • Descriptor: see @kingjs/descriptor

    Parameters

  • value: The value to create into a descriptor.
  • action: The name of the property to hold value or a function that accepts value and returns a descriptor.

    Returns

    Returns value if already a descriptor, else a normalized descriptor for value.

    Install

    With npm installed, run
    $ npm install @kingjs/descriptor.create
    

    License

    MIT

Analytics

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.