0.1.0 • Published 7 years ago

f-bind v0.1.0

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

F-bind

Library mimicking the proposed function-bind operator (::)

Using bind operator

const {unique} = require('some-array-extras-lib')
console.log(
  [1, 2, 2, 4]
  ::unique() // call custom method
  .filter(n => n % 2 == 0) // call native method
  .map(n => n * 10)
) // prints [20, 40]

Using f-bind library

const {unique} = require('some-array-extras-lib')
const $ = require('f-bind')
console.log(
  $([1, 2, 2, 4]) // wrap
  .$(unique)() // call custom method
  .$('filter')(n => n % 2 == 0) // call native method
  .$('map')(n => n * 10)
  .$() // unwrap
) // prints [20, 40]