1.1.1 • Published 4 years ago

object-tee v1.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

This package provides T-object functional.

Usage Example

function legacy(pair) {
    return [pair[0] + 4, pair[1] * 5];
}

const value = tee(13)
    .map(first => Math.floor(first / 10), second => second % 10)
    .do((first, second) => legacy(first, second))
    .swap()
    .reduce((first, second) => first / second);
console.log(value); // prints '3'

Tee Injection

let obj = {a: 13, tee: 34};
console.log(injectTee(obj)); // prints '{ a: 13 }' // `tee` property was re-defined

let injected = injectTee(obj, true);
injected.tee();
console.log(injected); // prints `{}` // `obj` is prototype of `injected`
console.log(Object.getPrototypeOf(injected)); // prints { a: 13, tee: 34 }
1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago