@thi.ng/associative
Advanced tools
Comparing version 0.5.11 to 0.6.0
import { Comparator, ICopy, IEmpty, IEquiv, Predicate2 } from "@thi.ng/api/api"; | ||
export declare type Pair<K, V> = [K, V]; | ||
export declare const SEMAPHORE: unique symbol; | ||
export interface IEquivSet<T> extends Set<T>, ICopy<IEquivSet<T>>, IEmpty<IEquivSet<T>>, IEquiv { | ||
@@ -5,0 +3,0 @@ readonly [Symbol.species]: EquivSetConstructor; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SEMAPHORE = Symbol("SEMAPHORE"); |
@@ -1,2 +0,3 @@ | ||
import { EquivSetOpts, IEquivSet, Pair } from "./api"; | ||
import { Pair } from "@thi.ng/api/api"; | ||
import { EquivSetOpts, IEquivSet } from "./api"; | ||
/** | ||
@@ -3,0 +4,0 @@ * An alternative set implementation to the native ES6 Set type. Uses |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const api_1 = require("@thi.ng/api/api"); | ||
const equiv_1 = require("@thi.ng/equiv"); | ||
const api_1 = require("./api"); | ||
const __private = new WeakMap(); | ||
@@ -6,0 +6,0 @@ /** |
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="0.6.0"></a> | ||
# [0.6.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/associative@0.5.11...@thi.ng/associative@0.6.0) (2018-08-24) | ||
### Features | ||
* **associative:** add IReducible impls for SortedMap & SortedSet ([f14f7ce](https://github.com/thi-ng/umbrella/commit/f14f7ce)) | ||
<a name="0.5.11"></a> | ||
@@ -8,0 +19,0 @@ ## [0.5.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/associative@0.5.10...@thi.ng/associative@0.5.11) (2018-08-01) |
@@ -1,3 +0,3 @@ | ||
import { ICopy, IEmpty, IEquiv, IObjectOf } from "@thi.ng/api/api"; | ||
import { EquivMapOpts, Pair } from "./api"; | ||
import { ICopy, IEmpty, IEquiv, IObjectOf, Pair } from "@thi.ng/api/api"; | ||
import { EquivMapOpts } from "./api"; | ||
export declare class EquivMap<K, V> extends Map<K, V> implements Iterable<Pair<K, V>>, ICopy<EquivMap<K, V>>, IEmpty<EquivMap<K, V>>, IEquiv { | ||
@@ -4,0 +4,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const api_1 = require("@thi.ng/api/api"); | ||
const equiv_1 = require("@thi.ng/equiv"); | ||
const api_1 = require("./api"); | ||
const array_set_1 = require("./array-set"); | ||
@@ -6,0 +6,0 @@ const __private = new WeakMap(); |
@@ -1,2 +0,3 @@ | ||
import { EquivSetOpts, IEquivSet, Pair } from "./api"; | ||
import { Pair } from "@thi.ng/api/api"; | ||
import { EquivSetOpts, IEquivSet } from "./api"; | ||
/** | ||
@@ -3,0 +4,0 @@ * Similar to `ArraySet`, this class is an alternative implementation of |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const api_1 = require("@thi.ng/api/api"); | ||
const dcons_1 = require("@thi.ng/dcons"); | ||
const equiv_1 = require("@thi.ng/equiv"); | ||
const dcons_1 = require("@thi.ng/dcons"); | ||
const api_1 = require("./api"); | ||
const __private = new WeakMap(); | ||
@@ -7,0 +7,0 @@ /** |
{ | ||
"name": "@thi.ng/associative", | ||
"version": "0.5.11", | ||
"version": "0.6.0", | ||
"description": "Alternative Set & Map data type implementations with customizable equality semantics & supporting operations", | ||
@@ -31,9 +31,9 @@ "main": "./index.js", | ||
"dependencies": { | ||
"@thi.ng/api": "^4.0.6", | ||
"@thi.ng/api": "^4.1.0", | ||
"@thi.ng/checks": "^1.5.7", | ||
"@thi.ng/compare": "^0.1.6", | ||
"@thi.ng/dcons": "^1.0.7", | ||
"@thi.ng/dcons": "^1.1.0", | ||
"@thi.ng/equiv": "^0.1.7", | ||
"@thi.ng/errors": "^0.1.6", | ||
"@thi.ng/iterators": "^4.1.20" | ||
"@thi.ng/transducers": "^2.0.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "keywords": [ |
@@ -1,3 +0,4 @@ | ||
import { ICompare, ICopy, IEmpty, IEquiv, IObjectOf } from "@thi.ng/api/api"; | ||
import { Pair, SortedMapOpts } from "./api"; | ||
import { ICompare, ICopy, IEmpty, IEquiv, IObjectOf, Pair } from "@thi.ng/api/api"; | ||
import { IReducible, ReductionFn } from "@thi.ng/transducers/api"; | ||
import { SortedMapOpts } from "./api"; | ||
/** | ||
@@ -21,3 +22,3 @@ * This class is an alternative implementation of the ES6 Map API using | ||
*/ | ||
export declare class SortedMap<K, V> extends Map<K, V> implements ICopy<SortedMap<K, V>>, ICompare<Map<K, V>>, IEmpty<SortedMap<K, V>>, IEquiv { | ||
export declare class SortedMap<K, V> extends Map<K, V> implements ICopy<SortedMap<K, V>>, ICompare<Map<K, V>>, IEmpty<SortedMap<K, V>>, IEquiv, IReducible<any, Pair<K, V>> { | ||
static fromObject<T>(obj: IObjectOf<T>): SortedMap<PropertyKey, T>; | ||
@@ -50,2 +51,3 @@ static readonly DEFAULT_CAP: number; | ||
into(pairs: Iterable<Pair<K, V>>): this; | ||
$reduce(rfn: ReductionFn<any, Pair<K, V>>, acc: any): any; | ||
entries(key?: K, reverse?: boolean): IterableIterator<Pair<K, V>>; | ||
@@ -52,0 +54,0 @@ keys(key?: K, reverse?: boolean): IterableIterator<K>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const api_1 = require("@thi.ng/api/api"); | ||
const is_array_1 = require("@thi.ng/checks/is-array"); | ||
const compare_1 = require("@thi.ng/compare"); | ||
const equiv_1 = require("@thi.ng/equiv"); | ||
const illegal_arguments_1 = require("@thi.ng/errors/illegal-arguments"); | ||
const is_array_1 = require("@thi.ng/checks/is-array"); | ||
const map_1 = require("@thi.ng/iterators/map"); | ||
const api_1 = require("./api"); | ||
const reduced_1 = require("@thi.ng/transducers/reduced"); | ||
const map_1 = require("@thi.ng/transducers/xform/map"); | ||
// stores private properties for all instances | ||
@@ -207,2 +208,11 @@ // http://fitzgeraldnick.com/2014/01/13/hiding-implementation-details-with-e6-weakmaps.html | ||
} | ||
$reduce(rfn, acc) { | ||
const $this = __private.get(this); | ||
let node = $this.head[NEXT]; | ||
while (node[KEY] !== undefined && !reduced_1.isReduced(acc)) { | ||
acc = rfn(acc, [node[KEY], node[VAL]]); | ||
node = node[NEXT]; | ||
} | ||
return acc; | ||
} | ||
*entries(key, reverse = false) { | ||
@@ -209,0 +219,0 @@ const $this = __private.get(this); |
@@ -1,3 +0,4 @@ | ||
import { ICompare } from "@thi.ng/api/api"; | ||
import { IEquivSet, Pair, SortedSetOpts } from "./api"; | ||
import { ICompare, Pair } from "@thi.ng/api/api"; | ||
import { IReducible, ReductionFn } from "@thi.ng/transducers/api"; | ||
import { IEquivSet, SortedSetOpts } from "./api"; | ||
/** | ||
@@ -18,3 +19,3 @@ * Sorted set implementation with standard ES6 Set API, customizable | ||
*/ | ||
export declare class SortedSet<T> extends Set<T> implements IEquivSet<T>, ICompare<Set<T>> { | ||
export declare class SortedSet<T> extends Set<T> implements IEquivSet<T>, ICompare<Set<T>>, IReducible<any, T> { | ||
/** | ||
@@ -36,2 +37,3 @@ * Creates new instance with optional given values and/or | ||
equiv(o: any): boolean; | ||
$reduce(rfn: ReductionFn<any, T>, acc: any): any; | ||
entries(): IterableIterator<Pair<T, T>>; | ||
@@ -38,0 +40,0 @@ keys(): IterableIterator<T>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const compare_1 = require("@thi.ng/compare"); | ||
const map_1 = require("@thi.ng/iterators/map"); | ||
const map_1 = require("@thi.ng/transducers/xform/map"); | ||
const sorted_map_1 = require("./sorted-map"); | ||
@@ -84,2 +84,5 @@ const __private = new WeakMap(); | ||
} | ||
$reduce(rfn, acc) { | ||
return __private.get(this).$reduce((_acc, x) => rfn(_acc, x[0]), acc); | ||
} | ||
entries() { | ||
@@ -86,0 +89,0 @@ return __private.get(this).entries(); |
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
82774
1938
+ Added@thi.ng/transducers@^2.0.0
- Removed@thi.ng/iterators@^4.1.20
- Removed@thi.ng/iterators@4.2.4(transitive)
Updated@thi.ng/api@^4.1.0
Updated@thi.ng/dcons@^1.1.0