From e7818a7b1f44fe789f8126c5eefa1ed54ef97dbe Mon Sep 17 00:00:00 2001 From: Karsten Schmidt Date: Tue, 12 Oct 2021 14:23:00 +0200 Subject: [PATCH] refactor(associative): rename internals --- packages/associative/src/array-set.ts | 8 ++++---- packages/associative/src/equiv-map.ts | 8 ++++---- packages/associative/src/hash-map.ts | 8 ++++---- packages/associative/src/internal/equiv.ts | 4 ++-- packages/associative/src/internal/inspect.ts | 2 +- packages/associative/src/ll-set.ts | 8 ++++---- packages/associative/src/sorted-map.ts | 8 ++++---- packages/associative/src/sorted-set.ts | 8 ++++---- packages/associative/src/sparse-set.ts | 4 ++-- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/associative/src/array-set.ts b/packages/associative/src/array-set.ts index 0b88f9b16a..58180b5495 100644 --- a/packages/associative/src/array-set.ts +++ b/packages/associative/src/array-set.ts @@ -4,8 +4,8 @@ import { findIndex } from "@thi.ng/arrays/find"; import { equiv } from "@thi.ng/equiv"; import type { EquivSetOpts, IEquivSet } from "./api"; import { dissoc } from "./dissoc"; -import { equivSet } from "./internal/equiv"; -import { inspectable } from "./internal/inspect"; +import { __equivSet } from "./internal/equiv"; +import { __inspectable } from "./internal/inspect"; import { into } from "./into"; interface ArraySetProps { @@ -28,7 +28,7 @@ const __vals = (inst: ArraySet) => __private.get(inst)!.vals; * {@link @thi.ng/api#IEmpty} and {@link @thi.ng/api#IEquiv} interfaces * itself. */ -@inspectable +@__inspectable export class ArraySet extends Set implements IEquivSet { constructor( vals?: Iterable | null, @@ -118,7 +118,7 @@ export class ArraySet extends Set implements IEquivSet { } equiv(o: any) { - return equivSet(this, o); + return __equivSet(this, o); } /** diff --git a/packages/associative/src/equiv-map.ts b/packages/associative/src/equiv-map.ts index 5e0d237f48..64a718ec6f 100644 --- a/packages/associative/src/equiv-map.ts +++ b/packages/associative/src/equiv-map.ts @@ -6,8 +6,8 @@ import { pairs } from "@thi.ng/transducers/pairs"; import type { EquivMapOpts, IEquivSet } from "./api"; import { ArraySet } from "./array-set"; import { dissoc } from "./dissoc"; -import { equivMap } from "./internal/equiv"; -import { inspectable } from "./internal/inspect"; +import { __equivMap } from "./internal/equiv"; +import { __inspectable } from "./internal/inspect"; import { into } from "./into"; interface MapProps { @@ -20,7 +20,7 @@ const __private = new WeakMap, MapProps>(); const __map = (map: EquivMap) => __private.get(map)!.map; -@inspectable +@__inspectable export class EquivMap extends Map implements @@ -92,7 +92,7 @@ export class EquivMap } equiv(o: any) { - return equivMap(this, o); + return __equivMap(this, o); } delete(key: K) { diff --git a/packages/associative/src/hash-map.ts b/packages/associative/src/hash-map.ts index 6225dc9d3a..70d0263e17 100644 --- a/packages/associative/src/hash-map.ts +++ b/packages/associative/src/hash-map.ts @@ -14,8 +14,8 @@ import { equiv } from "@thi.ng/equiv"; import { map } from "@thi.ng/transducers/map"; import type { HashMapOpts } from "./api"; import { dissoc } from "./dissoc"; -import { equivMap } from "./internal/equiv"; -import { inspectable } from "./internal/inspect"; +import { __equivMap } from "./internal/equiv"; +import { __inspectable } from "./internal/inspect"; import { into } from "./into"; interface HashMapState { @@ -59,7 +59,7 @@ const DEFAULT_LOAD = 0.75; * ``` * */ -@inspectable +@__inspectable export class HashMap extends Map implements @@ -151,7 +151,7 @@ export class HashMap } equiv(o: any) { - return equivMap(this, o); + return __equivMap(this, o); } has(key: K): boolean { diff --git a/packages/associative/src/internal/equiv.ts b/packages/associative/src/internal/equiv.ts index cd02679f61..a82e000f04 100644 --- a/packages/associative/src/internal/equiv.ts +++ b/packages/associative/src/internal/equiv.ts @@ -1,6 +1,6 @@ import { equiv } from "@thi.ng/equiv"; -export const equivMap = (a: Map, b: any) => { +export const __equivMap = (a: Map, b: any) => { if (a === b) { return true; } @@ -15,7 +15,7 @@ export const equivMap = (a: Map, b: any) => { return true; }; -export const equivSet = (a: Set, b: any) => { +export const __equivSet = (a: Set, b: any) => { if (a === b) { return true; } diff --git a/packages/associative/src/internal/inspect.ts b/packages/associative/src/internal/inspect.ts index bfc5da07b9..eaa3db1cbb 100644 --- a/packages/associative/src/internal/inspect.ts +++ b/packages/associative/src/internal/inspect.ts @@ -36,7 +36,7 @@ const inspectMap = (coll: Map, opts: any) => * * @internal */ -export const inspectable = mixin({ +export const __inspectable = mixin({ [Symbol.for("nodejs.util.inspect.custom")](depth: number, opts: any) { const name = this[Symbol.toStringTag]; const childOpts = { diff --git a/packages/associative/src/ll-set.ts b/packages/associative/src/ll-set.ts index 828fe0427b..03594f44c7 100644 --- a/packages/associative/src/ll-set.ts +++ b/packages/associative/src/ll-set.ts @@ -4,8 +4,8 @@ import { DCons } from "@thi.ng/dcons/dcons"; import { equiv } from "@thi.ng/equiv"; import type { EquivSetOpts, IEquivSet } from "./api"; import { dissoc } from "./dissoc"; -import { equivSet } from "./internal/equiv"; -import { inspectable } from "./internal/inspect"; +import { __equivSet } from "./internal/equiv"; +import { __inspectable } from "./internal/inspect"; import { into } from "./into"; interface SetProps { @@ -28,7 +28,7 @@ const __vals = (inst: LLSet) => __private.get(inst)!.vals; * {@link @thi.ng/api#IEmpty} and {@link @thi.ng/api#IEquiv} interfaces * itself. */ -@inspectable +@__inspectable export class LLSet extends Set implements IEquivSet { constructor( vals?: Iterable | null, @@ -128,7 +128,7 @@ export class LLSet extends Set implements IEquivSet { } equiv(o: any) { - return equivSet(this, o); + return __equivSet(this, o); } /** diff --git a/packages/associative/src/sorted-map.ts b/packages/associative/src/sorted-map.ts index 30f56c4a3e..0ed08c734b 100644 --- a/packages/associative/src/sorted-map.ts +++ b/packages/associative/src/sorted-map.ts @@ -7,8 +7,8 @@ import { map } from "@thi.ng/transducers/map"; import { isReduced } from "@thi.ng/transducers/reduced"; import type { SortedMapOpts } from "./api"; import { dissoc } from "./dissoc"; -import { equivMap } from "./internal/equiv"; -import { inspectable } from "./internal/inspect"; +import { __equivMap } from "./internal/equiv"; +import { __inspectable } from "./internal/inspect"; import { into } from "./into"; interface SortedMapState { @@ -37,7 +37,7 @@ class Node { // http://fitzgeraldnick.com/2014/01/13/hiding-implementation-details-with-e6-weakmaps.html const __private = new WeakMap, SortedMapState>(); -@inspectable +@__inspectable export class SortedMap extends Map { static DEFAULT_CAP = 8; static DEFAULT_P = 1 / Math.E; @@ -151,7 +151,7 @@ export class SortedMap extends Map { } equiv(o: any) { - return equivMap(this, o); + return __equivMap(this, o); } first(): Pair | undefined { diff --git a/packages/associative/src/sorted-set.ts b/packages/associative/src/sorted-set.ts index 0d3354c337..a38c239d49 100644 --- a/packages/associative/src/sorted-set.ts +++ b/packages/associative/src/sorted-set.ts @@ -4,8 +4,8 @@ import type { IReducible, ReductionFn } from "@thi.ng/transducers"; import { map } from "@thi.ng/transducers/map"; import type { IEquivSet, SortedSetOpts } from "./api"; import { dissoc } from "./dissoc"; -import { equivSet } from "./internal/equiv"; -import { inspectable } from "./internal/inspect"; +import { __equivSet } from "./internal/equiv"; +import { __inspectable } from "./internal/inspect"; import { into } from "./into"; import { SortedMap } from "./sorted-map"; @@ -29,7 +29,7 @@ const __private = new WeakMap, SortedMap>(); * This set uses a {@link SortedMap} as backing store and therefore has * the same resizing characteristics. */ -@inspectable +@__inspectable export class SortedSet extends Set implements IEquivSet, ICompare>, IReducible @@ -98,7 +98,7 @@ export class SortedSet } equiv(o: any) { - return equivSet(this, o); + return __equivSet(this, o); } $reduce(rfn: ReductionFn, acc: any): any { diff --git a/packages/associative/src/sparse-set.ts b/packages/associative/src/sparse-set.ts index dd8a574258..0433b827f3 100644 --- a/packages/associative/src/sparse-set.ts +++ b/packages/associative/src/sparse-set.ts @@ -3,7 +3,7 @@ import { isNumber } from "@thi.ng/checks/is-number"; import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; import type { IEquivSet } from "./api"; import { dissoc } from "./dissoc"; -import { inspectable } from "./internal/inspect"; +import { __inspectable } from "./internal/inspect"; import { into } from "./into"; interface SparseSetProps { @@ -24,7 +24,7 @@ const fail = () => illegalArgs(`dense & sparse arrays must be of same size`); * - {@link https://programmingpraxis.com/2012/03/09/sparse-sets/} * - {@link https://blog.molecular-matters.com/2013/07/24/adventures-in-data-oriented-design-part-3c-external-references/} */ -@inspectable +@__inspectable export abstract class ASparseSet extends Set implements IEquiv