oapply
v1.0.1
Published
apply a (asynchronous) function to an object and return this object, similar to kotlin's apply
Downloads
1
Readme
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