oapply

1.0.1 • Public • Published

oapply

apply a (asynchronous) function to an object and return this object, similar to kotlin's apply

quickstart

$ npm i oapply

test

$ npm run test

example

oapply(
  Promise.resolve({ a: 1 }),
  it => ++it.a,
  it => { it.a += 2 }
).then(it => console.log(it.a)) // output 4

Readme

Keywords

none

Package Sidebar

Install

npm i oapply

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

8.35 kB

Total Files

7

Last publish

Collaborators

  • xiechao06