@thi.ng/compose
Advanced tools
Comparing version
@@ -6,2 +6,14 @@ # Change Log | ||
# [1.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/compose@1.1.2...@thi.ng/compose@1.2.0) (2019-03-10) | ||
### Features | ||
* **compose:** add complement() ([5a5a2d1](https://github.com/thi-ng/umbrella/commit/5a5a2d1)) | ||
* **compose:** add trampoline() ([9e4c171](https://github.com/thi-ng/umbrella/commit/9e4c171)) | ||
## [1.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/compose@1.1.1...@thi.ng/compose@1.1.2) (2019-03-01) | ||
@@ -8,0 +20,0 @@ |
@@ -1,10 +0,10 @@ | ||
import { IDeref } from "@thi.ng/api"; | ||
export declare const delay: <T>(body: () => T) => Delay<T>; | ||
import { Fn0, IDeref } from "@thi.ng/api"; | ||
export declare const delay: <T>(body: Fn0<T>) => Delay<T>; | ||
export declare class Delay<T> implements IDeref<T> { | ||
value: T; | ||
protected body: () => T; | ||
protected body: Fn0<T>; | ||
protected realized: boolean; | ||
constructor(body: () => T); | ||
constructor(body: Fn0<T>); | ||
deref(): T; | ||
isRealized(): boolean; | ||
} |
export * from "./comp"; | ||
export * from "./complement"; | ||
export * from "./constantly"; | ||
@@ -10,1 +11,2 @@ export * from "./delay"; | ||
export * from "./thread-last"; | ||
export * from "./trampoline"; |
export * from "./comp"; | ||
export * from "./complement"; | ||
export * from "./constantly"; | ||
@@ -10,1 +11,2 @@ export * from "./delay"; | ||
export * from "./thread-last"; | ||
export * from "./trampoline"; |
@@ -41,2 +41,6 @@ 'use strict'; | ||
function complement(f) { | ||
return (...xs) => !f(...xs); | ||
} | ||
const constantly = (x) => () => x; | ||
@@ -129,5 +133,13 @@ | ||
const trampoline = (f) => { | ||
while (typeof f === "function") { | ||
f = f(); | ||
} | ||
return f; | ||
}; | ||
exports.comp = comp; | ||
exports.compL = compL; | ||
exports.compI = compI; | ||
exports.complement = complement; | ||
exports.constantly = constantly; | ||
@@ -143,1 +155,2 @@ exports.delay = delay; | ||
exports.threadLast = threadLast; | ||
exports.trampoline = trampoline; |
@@ -41,2 +41,6 @@ (function (global, factory) { | ||
function complement(f) { | ||
return (...xs) => !f(...xs); | ||
} | ||
const constantly = (x) => () => x; | ||
@@ -129,5 +133,13 @@ | ||
const trampoline = (f) => { | ||
while (typeof f === "function") { | ||
f = f(); | ||
} | ||
return f; | ||
}; | ||
exports.comp = comp; | ||
exports.compL = compL; | ||
exports.compI = compI; | ||
exports.complement = complement; | ||
exports.constantly = constantly; | ||
@@ -143,2 +155,3 @@ exports.delay = delay; | ||
exports.threadLast = threadLast; | ||
exports.trampoline = trampoline; | ||
@@ -145,0 +158,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "@thi.ng/compose", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Arity-optimized functional composition helpers", | ||
@@ -35,3 +35,3 @@ "module": "./index.js", | ||
"dependencies": { | ||
"@thi.ng/api": "^5.0.3", | ||
"@thi.ng/api": "^5.1.0", | ||
"@thi.ng/errors": "^1.0.3" | ||
@@ -49,3 +49,3 @@ }, | ||
"sideEffects": false, | ||
"gitHead": "e43f57c7554fd78380bba58d37ae62ca01221eeb" | ||
"gitHead": "794f0b6f07f6eef99f6f244d6c52c1d5de34675f" | ||
} |
@@ -1,9 +0,10 @@ | ||
export declare function partial<A, T>(fn: (a: A, ...args: any[]) => T, a: A): (...args: any[]) => T; | ||
export declare function partial<A, B, T>(fn: (a: A, b: B, ...args: any[]) => T, a: A, b: B): (...args: any[]) => T; | ||
export declare function partial<A, B, C, T>(fn: (a: A, b: B, c: C, ...args: any[]) => T, a: A, b: B, c: C): (...args: any[]) => T; | ||
export declare function partial<A, B, C, D, T>(fn: (a: A, b: B, c: C, d: D, ...args: any[]) => T, a: A, b: B, c: C, d: D): (...args: any[]) => T; | ||
export declare function partial<A, B, C, D, E, T>(fn: (a: A, b: B, c: C, d: D, e: E, ...args: any[]) => T, a: A, b: B, c: C, d: D, e: E): (...args: any[]) => T; | ||
export declare function partial<A, B, C, D, E, F, T>(fn: (a: A, b: B, c: C, d: D, e: E, f: F, ...args: any[]) => T, a: A, b: B, c: C, d: D, e: E, f: F): (...args: any[]) => T; | ||
export declare function partial<A, B, C, D, E, F, G, T>(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, ...args: any[]) => T, a: A, b: B, c: C, d: D, e: E, f: F, g: G): (...args: any[]) => T; | ||
export declare function partial<A, B, C, D, E, F, G, H, T>(fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, ...args: any[]) => T, a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H): (...args: any[]) => T; | ||
export declare const foo: (...args: any[]) => string; | ||
import { FnAny, FnO, FnO2, FnO3, FnO4, FnO5, FnO6, FnO7, FnO8 } from "@thi.ng/api"; | ||
export declare function partial<A, T>(fn: FnO<A, T>, a: A): FnAny<T>; | ||
export declare function partial<A, B, T>(fn: FnO2<A, B, T>, a: A, b: B): FnAny<T>; | ||
export declare function partial<A, B, C, T>(fn: FnO3<A, B, C, T>, a: A, b: B, c: C): FnAny<T>; | ||
export declare function partial<A, B, C, D, T>(fn: FnO4<A, B, C, D, T>, a: A, b: B, c: C, d: D): FnAny<T>; | ||
export declare function partial<A, B, C, D, E, T>(fn: FnO5<A, B, C, D, E, T>, a: A, b: B, c: C, d: D, e: E): FnAny<T>; | ||
export declare function partial<A, B, C, D, E, F, T>(fn: FnO6<A, B, C, D, E, F, T>, a: A, b: B, c: C, d: D, e: E, f: F): FnAny<T>; | ||
export declare function partial<A, B, C, D, E, F, G, T>(fn: FnO7<A, B, C, D, E, F, G, T>, a: A, b: B, c: C, d: D, e: E, f: F, g: G): FnAny<T>; | ||
export declare function partial<A, B, C, D, E, F, G, H, T>(fn: FnO8<A, B, C, D, E, F, G, H, T>, a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H): FnAny<T>; | ||
export declare const foo: FnAny<string>; |
@@ -12,8 +12,8 @@ # @thi.ng/compose | ||
- [About](#about) | ||
- [Installation](#installation) | ||
- [Dependencies](#dependencies) | ||
- [Usage examples](#usage-examples) | ||
- [Authors](#authors) | ||
- [License](#license) | ||
- [About](#about) | ||
- [Installation](#installation) | ||
- [Dependencies](#dependencies) | ||
- [Usage examples](#usage-examples) | ||
- [Authors](#authors) | ||
- [License](#license) | ||
@@ -26,8 +26,9 @@ <!-- /TOC --> | ||
- [comp()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/comp.ts) | ||
- [compL()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/comp.ts#L52) | ||
- [juxt()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/juxt.ts) | ||
- [partial()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/partial.ts) | ||
- [threadFirst()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/thread-first.ts) | ||
- [threadLast()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/thread-last.ts) | ||
- [comp()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/comp.ts) | ||
- [compL()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/comp.ts#L52) | ||
- [juxt()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/juxt.ts) | ||
- [partial()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/partial.ts) | ||
- [threadFirst()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/thread-first.ts) | ||
- [threadLast()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/thread-last.ts) | ||
- [trampoline()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/trampoline.ts) | ||
@@ -42,4 +43,4 @@ ## Installation | ||
- [@thi.ng/api](https://github.com/thi-ng/umbrella/tree/master/packages/api) | ||
- [@thi.ng/errors](https://github.com/thi-ng/umbrella/tree/master/packages/errors) | ||
- [@thi.ng/api](https://github.com/thi-ng/umbrella/tree/master/packages/api) | ||
- [@thi.ng/errors](https://github.com/thi-ng/umbrella/tree/master/packages/errors) | ||
@@ -54,3 +55,3 @@ ## Usage examples | ||
- Karsten Schmidt | ||
- Karsten Schmidt | ||
@@ -57,0 +58,0 @@ ## License |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
57305
8.28%32
14.29%675
17.8%57
1.79%Updated