Skip to content

Commit

Permalink
refactor(associative): rename internals
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Oct 12, 2021
1 parent 6f0c8c3 commit e7818a7
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions packages/associative/src/array-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> {
Expand All @@ -28,7 +28,7 @@ const __vals = (inst: ArraySet<any>) => __private.get(inst)!.vals;
* {@link @thi.ng/api#IEmpty} and {@link @thi.ng/api#IEquiv} interfaces
* itself.
*/
@inspectable
@__inspectable
export class ArraySet<T> extends Set<T> implements IEquivSet<T> {
constructor(
vals?: Iterable<T> | null,
Expand Down Expand Up @@ -118,7 +118,7 @@ export class ArraySet<T> extends Set<T> implements IEquivSet<T> {
}

equiv(o: any) {
return equivSet(this, o);
return __equivSet(this, o);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/associative/src/equiv-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<K, V> {
Expand All @@ -20,7 +20,7 @@ const __private = new WeakMap<EquivMap<any, any>, MapProps<any, any>>();

const __map = (map: EquivMap<any, any>) => __private.get(map)!.map;

@inspectable
@__inspectable
export class EquivMap<K, V>
extends Map<K, V>
implements
Expand Down Expand Up @@ -92,7 +92,7 @@ export class EquivMap<K, V>
}

equiv(o: any) {
return equivMap(this, o);
return __equivMap(this, o);
}

delete(key: K) {
Expand Down
8 changes: 4 additions & 4 deletions packages/associative/src/hash-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<K, V> {
Expand Down Expand Up @@ -59,7 +59,7 @@ const DEFAULT_LOAD = 0.75;
* ```
*
*/
@inspectable
@__inspectable
export class HashMap<K, V>
extends Map<K, V>
implements
Expand Down Expand Up @@ -151,7 +151,7 @@ export class HashMap<K, V>
}

equiv(o: any) {
return equivMap(this, o);
return __equivMap(this, o);
}

has(key: K): boolean {
Expand Down
4 changes: 2 additions & 2 deletions packages/associative/src/internal/equiv.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { equiv } from "@thi.ng/equiv";

export const equivMap = (a: Map<any, any>, b: any) => {
export const __equivMap = (a: Map<any, any>, b: any) => {
if (a === b) {
return true;
}
Expand All @@ -15,7 +15,7 @@ export const equivMap = (a: Map<any, any>, b: any) => {
return true;
};

export const equivSet = (a: Set<any>, b: any) => {
export const __equivSet = (a: Set<any>, b: any) => {
if (a === b) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/associative/src/internal/inspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const inspectMap = (coll: Map<any, any>, 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 = {
Expand Down
8 changes: 4 additions & 4 deletions packages/associative/src/ll-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> {
Expand All @@ -28,7 +28,7 @@ const __vals = (inst: LLSet<any>) => __private.get(inst)!.vals;
* {@link @thi.ng/api#IEmpty} and {@link @thi.ng/api#IEquiv} interfaces
* itself.
*/
@inspectable
@__inspectable
export class LLSet<T> extends Set<T> implements IEquivSet<T> {
constructor(
vals?: Iterable<T> | null,
Expand Down Expand Up @@ -128,7 +128,7 @@ export class LLSet<T> extends Set<T> implements IEquivSet<T> {
}

equiv(o: any) {
return equivSet(this, o);
return __equivSet(this, o);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/associative/src/sorted-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<K, V> {
Expand Down Expand Up @@ -37,7 +37,7 @@ class Node<K, V> {
// http://fitzgeraldnick.com/2014/01/13/hiding-implementation-details-with-e6-weakmaps.html
const __private = new WeakMap<SortedMap<any, any>, SortedMapState<any, any>>();

@inspectable
@__inspectable
export class SortedMap<K, V> extends Map<K, V> {
static DEFAULT_CAP = 8;
static DEFAULT_P = 1 / Math.E;
Expand Down Expand Up @@ -151,7 +151,7 @@ export class SortedMap<K, V> extends Map<K, V> {
}

equiv(o: any) {
return equivMap(this, o);
return __equivMap(this, o);
}

first(): Pair<K, V> | undefined {
Expand Down
8 changes: 4 additions & 4 deletions packages/associative/src/sorted-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -29,7 +29,7 @@ const __private = new WeakMap<SortedSet<any>, SortedMap<any, any>>();
* This set uses a {@link SortedMap} as backing store and therefore has
* the same resizing characteristics.
*/
@inspectable
@__inspectable
export class SortedSet<T>
extends Set<T>
implements IEquivSet<T>, ICompare<Set<T>>, IReducible<any, T>
Expand Down Expand Up @@ -98,7 +98,7 @@ export class SortedSet<T>
}

equiv(o: any) {
return equivSet(this, o);
return __equivSet(this, o);
}

$reduce(rfn: ReductionFn<any, T>, acc: any): any {
Expand Down
4 changes: 2 additions & 2 deletions packages/associative/src/sparse-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<T extends UIntArray>
extends Set<number>
implements IEquiv
Expand Down

0 comments on commit e7818a7

Please sign in to comment.