@thi.ng/transducers
Advanced tools
Comparing version 1.6.2 to 1.7.0
@@ -6,2 +6,14 @@ # Change Log | ||
<a name="1.7.0"></a> | ||
# [1.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/transducers@1.6.2...@thi.ng/transducers@1.7.0) (2018-03-19) | ||
### Features | ||
* **transducers:** add mapVals() xform ([abc195a](https://github.com/thi-ng/umbrella/commit/abc195a)) | ||
* **transducers:** add partitionSync() xform ([bebd118](https://github.com/thi-ng/umbrella/commit/bebd118)) | ||
<a name="1.6.2"></a> | ||
@@ -8,0 +20,0 @@ ## [1.6.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/transducers@1.6.1...@thi.ng/transducers@1.6.2) (2018-03-08) |
@@ -51,8 +51,9 @@ export * from "./api"; | ||
export * from "./xform/labeled"; | ||
export * from "./xform/map-deep"; | ||
export * from "./xform/map-indexed"; | ||
export * from "./xform/map-keys"; | ||
export * from "./xform/map-nth"; | ||
export * from "./xform/map-vals"; | ||
export * from "./xform/map"; | ||
export * from "./xform/mapcat"; | ||
export * from "./xform/map-deep"; | ||
export * from "./xform/moving-average"; | ||
@@ -68,2 +69,3 @@ export * from "./xform/moving-median"; | ||
export * from "./xform/partition-sort"; | ||
export * from "./xform/partition-sync"; | ||
export * from "./xform/partition"; | ||
@@ -70,0 +72,0 @@ export * from "./xform/pluck"; |
@@ -56,8 +56,9 @@ "use strict"; | ||
__export(require("./xform/labeled")); | ||
__export(require("./xform/map-deep")); | ||
__export(require("./xform/map-indexed")); | ||
__export(require("./xform/map-keys")); | ||
__export(require("./xform/map-nth")); | ||
__export(require("./xform/map-vals")); | ||
__export(require("./xform/map")); | ||
__export(require("./xform/mapcat")); | ||
__export(require("./xform/map-deep")); | ||
__export(require("./xform/moving-average")); | ||
@@ -73,2 +74,3 @@ __export(require("./xform/moving-median")); | ||
__export(require("./xform/partition-sort")); | ||
__export(require("./xform/partition-sync")); | ||
__export(require("./xform/partition")); | ||
@@ -75,0 +77,0 @@ __export(require("./xform/pluck")); |
{ | ||
"name": "@thi.ng/transducers", | ||
"version": "1.6.2", | ||
"version": "1.7.0", | ||
"description": "Lightweight transducer implementations for ES6 / TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -608,3 +608,3 @@ # @thi.ng/transducers | ||
#### `labeled<L, T>(id: L): Transducer<T, [L, T]>` | ||
#### `labeled<L, T>(id: L | ((x: T) => L)): Transducer<T, [L, T]>` | ||
@@ -617,3 +617,3 @@ #### `map<A, B>(fn: (x: A) => B): Transducer<A, B>` | ||
#### `mapIndexed<A, B>(fn: (i: number, x: A) => B): Transducer<A, B>` | ||
#### `mapIndexed<A, B>(fn: (i: number, x: A) => B, offset = 0): Transducer<A, B>` | ||
@@ -624,2 +624,5 @@ #### `mapKeys(keys: IObjectOf<(x: any) => any>, copy?: boolean): Transducer<any, any>` | ||
#### `mapVals<A, B>(fn: (v: A) => B, copy = true): Transducer<IObjectOf<A>, IObjectOf<B>>` | ||
#### `movingAverage(n: number): Transducer<number, number>` | ||
@@ -647,2 +650,4 @@ | ||
#### `partitionSync<T>(keys: PropertyKey[] | Set<PropertyKey>, keyfn: (x: T) => PropertyKey, reset = true, all = true): Transducer<T, IObjectOf<T>>` | ||
#### `pluck<A, B>(key: PropertyKey): Transducer<A, B>` | ||
@@ -649,0 +654,0 @@ |
import { Transducer } from "../api"; | ||
export declare function labeled<L, T>(id: L): Transducer<T, [L, T]>; | ||
export declare function labeled<L, T>(id: L | ((x: T) => L)): Transducer<T, [L, T]>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const is_function_1 = require("@thi.ng/checks/is-function"); | ||
const map_1 = require("./map"); | ||
function labeled(id) { | ||
return map_1.map((x) => [id, x]); | ||
return map_1.map(is_function_1.isFunction(id) ? | ||
(x) => [id(x), x] : | ||
(x) => [id, x]); | ||
} | ||
exports.labeled = labeled; |
import { Transducer } from "../api"; | ||
export declare function mapIndexed<A, B>(fn: (i: number, x: A) => B): Transducer<A, B>; | ||
export declare function mapIndexed<A, B>(fn: (i: number, x: A) => B, offset?: number): Transducer<A, B>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const compr_1 = require("../func/compr"); | ||
function mapIndexed(fn) { | ||
function mapIndexed(fn, offset = 0) { | ||
return (rfn) => { | ||
const r = rfn[2]; | ||
let i = 0; | ||
let i = offset; | ||
return compr_1.compR(rfn, (acc, x) => r(acc, fn(i++, x))); | ||
@@ -9,0 +9,0 @@ }; |
@@ -19,3 +19,3 @@ "use strict"; | ||
(acc) => { | ||
if (buf.length && (all || buf.length === size)) { | ||
if (all && buf.length > 0) { | ||
acc = reduce(acc, buf); | ||
@@ -22,0 +22,0 @@ buf = []; |
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
170010
244
3680
768
60