@thi.ng/compose
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [1.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/compose@1.0.2...@thi.ng/compose@1.1.0) (2019-02-15) | ||
### Bug Fixes | ||
* **compose:** add varargs override for jux(), add tests ([e9d57fc](https://github.com/thi-ng/umbrella/commit/e9d57fc)) | ||
### Features | ||
* **compose:** add new functions ([dd13fa9](https://github.com/thi-ng/umbrella/commit/dd13fa9)) | ||
## [1.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/compose@1.0.1...@thi.ng/compose@1.0.2) (2019-02-05) | ||
@@ -8,0 +24,0 @@ |
export * from "./comp"; | ||
export * from "./constantly"; | ||
export * from "./delay"; | ||
export * from "./delayed"; | ||
export * from "./identity"; | ||
export * from "./juxt"; | ||
@@ -3,0 +7,0 @@ export * from "./partial"; |
export * from "./comp"; | ||
export * from "./constantly"; | ||
export * from "./delay"; | ||
export * from "./delayed"; | ||
export * from "./identity"; | ||
export * from "./juxt"; | ||
@@ -3,0 +7,0 @@ export * from "./partial"; |
@@ -10,1 +10,2 @@ import { Fn } from "@thi.ng/api"; | ||
export declare function juxt<T, A, B, C, D, E, F, G, H>(a: Fn<T, A>, b: Fn<T, B>, c: Fn<T, C>, d: Fn<T, D>, e: Fn<T, E>, f: Fn<T, F>, g: Fn<T, G>, h: Fn<T, H>): Fn<T, [A, B, C, D, E, F, G, H]>; | ||
export declare function juxt<T, A, B, C, D, E, F, G, H>(a: Fn<T, A>, b: Fn<T, B>, c: Fn<T, C>, d: Fn<T, D>, e: Fn<T, E>, f: Fn<T, F>, g: Fn<T, G>, h: Fn<T, H>, ...xs: Fn<T, any>[]): Fn<T, any[]>; |
@@ -41,2 +41,26 @@ 'use strict'; | ||
const constantly = (x) => () => x; | ||
const delay = (body) => new Delay(body); | ||
class Delay { | ||
constructor(body) { | ||
this.body = body; | ||
this.realized = false; | ||
} | ||
deref() { | ||
if (!this.realized) { | ||
this.value = this.body(); | ||
this.realized = true; | ||
} | ||
return this.value; | ||
} | ||
isRealized() { | ||
return this.realized; | ||
} | ||
} | ||
const delayed = (x, t) => new Promise((resolve) => setTimeout(() => resolve(x), t)); | ||
const identity = (x) => x; | ||
function juxt(...fns) { | ||
@@ -108,2 +132,7 @@ const [a, b, c, d, e, f, g, h] = fns; | ||
exports.compI = compI; | ||
exports.constantly = constantly; | ||
exports.delay = delay; | ||
exports.Delay = Delay; | ||
exports.delayed = delayed; | ||
exports.identity = identity; | ||
exports.juxt = juxt; | ||
@@ -110,0 +139,0 @@ exports.partial = partial; |
@@ -41,2 +41,26 @@ (function (global, factory) { | ||
const constantly = (x) => () => x; | ||
const delay = (body) => new Delay(body); | ||
class Delay { | ||
constructor(body) { | ||
this.body = body; | ||
this.realized = false; | ||
} | ||
deref() { | ||
if (!this.realized) { | ||
this.value = this.body(); | ||
this.realized = true; | ||
} | ||
return this.value; | ||
} | ||
isRealized() { | ||
return this.realized; | ||
} | ||
} | ||
const delayed = (x, t) => new Promise((resolve) => setTimeout(() => resolve(x), t)); | ||
const identity = (x) => x; | ||
function juxt(...fns) { | ||
@@ -108,2 +132,7 @@ const [a, b, c, d, e, f, g, h] = fns; | ||
exports.compI = compI; | ||
exports.constantly = constantly; | ||
exports.delay = delay; | ||
exports.Delay = Delay; | ||
exports.delayed = delayed; | ||
exports.identity = identity; | ||
exports.juxt = juxt; | ||
@@ -110,0 +139,0 @@ exports.partial = partial; |
{ | ||
"name": "@thi.ng/compose", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Arity-optimized functional composition helpers", | ||
@@ -48,3 +48,3 @@ "module": "./index.js", | ||
"sideEffects": false, | ||
"gitHead": "74fb4d83013785ce7a95357c565426a046657e74" | ||
"gitHead": "418f7af20c8ce3098e86bbc3a2377ccbac761b70" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52572
28
573