@thi.ng/transducers
Advanced tools
Comparing version 0.11.0 to 0.11.1
@@ -1,1 +0,1 @@ | ||
export declare function keySelector<T>(keys: PropertyKey[]): (x: any) => any; | ||
export declare function keySelector(keys: PropertyKey[]): (x: any) => any; |
@@ -26,2 +26,3 @@ export * from "./api"; | ||
export * from "./rfn/push"; | ||
export * from "./rfn/reductions"; | ||
export * from "./xform/base64"; | ||
@@ -28,0 +29,0 @@ export * from "./xform/benchmark"; |
@@ -31,2 +31,3 @@ "use strict"; | ||
__export(require("./rfn/push")); | ||
__export(require("./rfn/reductions")); | ||
__export(require("./xform/base64")); | ||
@@ -33,0 +34,0 @@ __export(require("./xform/benchmark")); |
@@ -6,7 +6,8 @@ "use strict"; | ||
function* iterator(tx, xs) { | ||
const [_, c, r] = tx(push_1.push()); | ||
const [_, complete, reduce] = tx(push_1.push()); | ||
_; | ||
for (let x of xs) { | ||
const y = r([], x); | ||
const y = reduce([], x); | ||
if (reduced_1.isReduced(y)) { | ||
yield* reduced_1.unreduced(c(y.deref())); | ||
yield* reduced_1.unreduced(complete(y.deref())); | ||
return; | ||
@@ -18,4 +19,4 @@ } | ||
} | ||
yield* reduced_1.unreduced(c([])); | ||
yield* reduced_1.unreduced(complete([])); | ||
} | ||
exports.iterator = iterator; |
{ | ||
"name": "@thi.ng/transducers", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"description": "Lightweight transducer implementations for ES6 / TypeScript", | ||
"main": "index.js", | ||
"typings": "index.d.ts", | ||
"main": "./index.js", | ||
"typings": "./index.d.ts", | ||
"repository": "https://github.com/thi-ng/transducers", | ||
"author": "Karsten Schmidt", | ||
"author": "Karsten Schmidt <k+npm@thi.ng>", | ||
"license": "Apache-2.0", | ||
"scripts": { | ||
"build": "rm -rf build && tsc --declaration && cp package.json build", | ||
"doc": "node_modules/.bin/typedoc --mode modules --out doc src", | ||
"test": "tsc -p test && mocha build.test/test/*.js", | ||
"clean": "rm -rf build build.test doc node_modules && yarn install", | ||
"pub": "yarn run build && cp *.md LICENSE build && (cd build && yarn publish --access public)" | ||
"build": "yarn run clean && tsc --declaration", | ||
"test": "yarn run clean && tsc -p test && mocha build/test/*.js", | ||
"clean": "rm -rf *.js *.d.ts build doc func iter rfn xform", | ||
"pub": "yarn run build && (cd build && yarn publish --access public)" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^4.0.1", | ||
"@types/mocha": "^2.2.46", | ||
"@types/node": "^9.3.0", | ||
"mocha": "^5.0.0", | ||
"ts-loader": "^3.3.1", | ||
"typedoc": "^0.9.0", | ||
"typescript": "^2.6.2" | ||
"typescript": "^2.6.2", | ||
"webpack": "^3.10.0" | ||
}, | ||
"dependencies": { | ||
"@thi.ng/api": "^1.1.1" | ||
"@thi.ng/api": "^1.2.1" | ||
}, | ||
"keywords": [ | ||
"ES6", | ||
"typescript", | ||
"transducer", | ||
"reducer", | ||
"generator", | ||
"iterator", | ||
"functional", | ||
"pipeline" | ||
] | ||
} | ||
"generators", | ||
"iterators", | ||
"pipeline", | ||
"reducers", | ||
"transducers", | ||
"typescript" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
@@ -627,2 +627,3 @@ # @thi.ng/transducers | ||
## Authors | ||
- Karsten Schmidt | ||
@@ -629,0 +630,0 @@ |
@@ -17,6 +17,6 @@ "use strict"; | ||
} | ||
const [i, c, r] = args[0]; | ||
acc = acc == null ? i() : acc; | ||
const [init, complete, reduce] = args[0]; | ||
acc = acc == null ? init() : acc; | ||
for (let x of xs) { | ||
acc = r(acc, x); | ||
acc = reduce(acc, x); | ||
if (reduced_1.isReduced(acc)) { | ||
@@ -27,4 +27,4 @@ acc = acc.deref(); | ||
} | ||
return reduced_1.unreduced(c(acc)); | ||
return reduced_1.unreduced(complete(acc)); | ||
} | ||
exports.reduce = reduce; |
@@ -8,4 +8,4 @@ import { IDeref } from "@thi.ng/api/api"; | ||
export declare function reduced(x: any): any; | ||
export declare function isReduced(x: any): boolean; | ||
export declare function isReduced<T>(x: any): x is Reduced<T>; | ||
export declare function ensureReduced(x: any): Reduced<any>; | ||
export declare function unreduced(x: any): any; |
@@ -8,3 +8,3 @@ "use strict"; | ||
const partition_1 = require("./partition"); | ||
// TODO optimize | ||
// TODO optimize, see @thi.ng/indicators/sma | ||
function movingAverage(n) { | ||
@@ -11,0 +11,0 @@ return comp_1.comp(partition_1.partition(n, 1, true), map_1.map((x) => reduce_1.reduce(mean_1.mean(), x))); |
@@ -5,4 +5,4 @@ "use strict"; | ||
const reduced_1 = require("../reduced"); | ||
const binary_search_1 = require("../func/binary-search"); | ||
const identity_1 = require("../func/identity"); | ||
const binary_search_1 = require("../func/binary-search"); | ||
function streamSort(n, key = identity_1.identity, cmp = compare_1.compare) { | ||
@@ -9,0 +9,0 @@ return ([init, complete, reduce]) => { |
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
113656
200
2393
633
7
Updated@thi.ng/api@^1.2.1