1.0.18 • Published 5 years ago

@kingjs/descriptor.update v1.0.18

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@kingjs/descriptor.update

Updates values of a descriptor using a callback.

Usage

Increment all descriptor values like this:

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

function callback(value, key) {
  return value + 1;
}

var descriptor = {
  foo: 0,
  bar: 1,
}

update.call(descriptor, callback);

result:

{
  foo: 1,
  bar: 2
}

API

declare function update(
  this: Descriptor,
  callback: (this, value, key: string) => any,
  thisArg?
): Descriptor

Interfaces

Parameters

  • this: The descriptor whose properties are to be mapped.
  • callback: A mapping function called for each property of this.
    • value: The value being mapped.
    • key: The name of the property being mapped.
  • thisArg: The this argument to pass to callback.

Returns

Returns this after mapping properties using the callback.

Install

With npm installed, run

$ npm install @kingjs/descriptor.update

License

MIT

Analytics

1.0.18

5 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago