@effect/data
Advanced tools
Comparing version 0.18.4 to 0.18.5
@@ -41,8 +41,8 @@ "use strict"; | ||
toString() { | ||
return `Chunk(${toReadonlyArray(this).map(String).join(", ")})`; | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "Chunk", | ||
values: toReadonlyArray(this) | ||
_id: "Chunk", | ||
values: toReadonlyArray(this).map(_Inspectable.toJSON) | ||
}; | ||
@@ -49,0 +49,0 @@ }, |
@@ -80,25 +80,24 @@ "use strict"; | ||
toString() { | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
switch (this.value._tag) { | ||
case "Millis": | ||
return `Duration("${this.value.millis} millis")`; | ||
return { | ||
_id: "Duration", | ||
_tag: "Millis", | ||
millis: this.value.millis | ||
}; | ||
case "Nanos": | ||
return `Duration("${this.value.nanos} nanos")`; | ||
case "Infinity": | ||
return "Duration(Infinity)"; | ||
} | ||
}, | ||
toJSON() { | ||
if (this.value._tag === "Nanos") { | ||
return { | ||
_tag: "Duration", | ||
value: { | ||
return { | ||
_id: "Duration", | ||
_tag: "Nanos", | ||
hrtime: toHrTime(this) | ||
} | ||
}; | ||
}; | ||
case "Infinity": | ||
return { | ||
_id: "Duration", | ||
_tag: "Infinity" | ||
}; | ||
} | ||
return { | ||
_tag: "Duration", | ||
value: this.value | ||
}; | ||
}, | ||
@@ -105,0 +104,0 @@ [_Inspectable.NodeInspectSymbol]() { |
@@ -23,6 +23,2 @@ /** | ||
export declare function equals<B>(that: B): <A>(self: A) => boolean; | ||
/** | ||
* @since 1.0.0 | ||
* @category equality | ||
*/ | ||
export declare function equals<A, B>(self: A, that: B): boolean; | ||
@@ -29,0 +25,0 @@ /** |
@@ -48,4 +48,4 @@ "use strict"; | ||
exports.isEqual = isEqual; | ||
const equivalence = () => (self, that) => Hash.hash(self) === Hash.hash(that) && equals(self, that); | ||
const equivalence = () => (self, that) => equals(self, that); | ||
exports.equivalence = equivalence; | ||
//# sourceMappingURL=Equal.js.map |
@@ -23,2 +23,10 @@ /** | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const toJSON: (x: unknown) => unknown; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const toString: (x: unknown) => string; | ||
//# sourceMappingURL=Inspectable.d.ts.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.NodeInspectSymbol = void 0; | ||
exports.toString = exports.toJSON = exports.NodeInspectSymbol = void 0; | ||
/** | ||
@@ -16,3 +16,20 @@ * @since 1.0.0 | ||
const NodeInspectSymbol = /*#__PURE__*/Symbol.for("nodejs.util.inspect.custom"); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
exports.NodeInspectSymbol = NodeInspectSymbol; | ||
const toJSON = x => { | ||
if (typeof x === "object" && x !== null && "toJSON" in x && typeof x["toJSON"] === "function" && x["toJSON"].length === 0) { | ||
return x.toJSON(); | ||
} else if (Array.isArray(x)) { | ||
return x.map(toJSON); | ||
} | ||
return x; | ||
}; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
exports.toJSON = toJSON; | ||
const toString = x => JSON.stringify(x, null, 2); | ||
exports.toString = toString; | ||
//# sourceMappingURL=Inspectable.js.map |
@@ -35,7 +35,7 @@ "use strict"; | ||
toString() { | ||
return JSON.stringify(this, null, 2); | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "Tag", | ||
_id: "Tag", | ||
identifier: this.identifier, | ||
@@ -110,8 +110,8 @@ stack: this.stack | ||
toString() { | ||
return JSON.stringify(this, null, 2); | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "Context", | ||
services: Array.from(this.unsafeMap) | ||
_id: "Context", | ||
services: Array.from(this.unsafeMap).map(_Inspectable.toJSON) | ||
}; | ||
@@ -118,0 +118,0 @@ }, |
@@ -37,3 +37,3 @@ "use strict"; | ||
toString() { | ||
return JSON.stringify(this, null, 2); | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
} | ||
@@ -51,4 +51,5 @@ }; | ||
return { | ||
_id: "Either", | ||
_tag: this._tag, | ||
right: this.right | ||
right: (0, _Inspectable.toJSON)(this.right) | ||
}; | ||
@@ -67,4 +68,5 @@ } | ||
return { | ||
_id: "Either", | ||
_tag: this._tag, | ||
left: this.left | ||
left: (0, _Inspectable.toJSON)(this.left) | ||
}; | ||
@@ -71,0 +73,0 @@ } |
@@ -54,8 +54,8 @@ "use strict"; | ||
toString() { | ||
return `HashMap(${Array.from(this).map(([k, v]) => `[${String(k)}, ${String(v)}]`).join(", ")})`; | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "HashMap", | ||
values: Array.from(this) | ||
_id: "HashMap", | ||
values: Array.from(this).map(_Inspectable.toJSON) | ||
}; | ||
@@ -62,0 +62,0 @@ }, |
@@ -34,8 +34,8 @@ "use strict"; | ||
toString() { | ||
return `HashSet(${Array.from(this).map(String).join(", ")})`; | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "HashSet", | ||
values: Array.from(this) | ||
_id: "HashSet", | ||
values: Array.from(this).map(_Inspectable.toJSON) | ||
}; | ||
@@ -42,0 +42,0 @@ }, |
@@ -31,3 +31,3 @@ "use strict"; | ||
toString() { | ||
return JSON.stringify(this, null, 2); | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
} | ||
@@ -45,4 +45,5 @@ }; | ||
return { | ||
_id: "Option", | ||
_tag: this._tag, | ||
value: this.value | ||
value: (0, _Inspectable.toJSON)(this.value) | ||
}; | ||
@@ -61,2 +62,3 @@ } | ||
return { | ||
_id: "Option", | ||
_tag: this._tag | ||
@@ -63,0 +65,0 @@ }; |
@@ -48,8 +48,8 @@ "use strict"; | ||
toString() { | ||
return `RedBlackTree(${Array.from(this).map(([k, v]) => `[${String(k)}, ${String(v)}]`).join(", ")})`; | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "RedBlackTree", | ||
values: Array.from(this) | ||
_id: "RedBlackTree", | ||
values: Array.from(this).map(_Inspectable.toJSON) | ||
}; | ||
@@ -56,0 +56,0 @@ }, |
12
List.js
@@ -68,8 +68,9 @@ "use strict"; | ||
toString() { | ||
return `List.Cons(${toReadonlyArray(this).map(String).join(", ")})`; | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "List.Cons", | ||
values: toReadonlyArray(this) | ||
_id: "List", | ||
_tag: "Cons", | ||
values: toReadonlyArray(this).map(_Inspectable.toJSON) | ||
}; | ||
@@ -131,7 +132,8 @@ }, | ||
toString() { | ||
return `List.Nil`; | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "List.Nil" | ||
_id: "List", | ||
_tag: "Nil" | ||
}; | ||
@@ -138,0 +140,0 @@ }, |
@@ -26,8 +26,8 @@ "use strict"; | ||
toString() { | ||
return `MutableHashMap(${Array.from(this).map(([k, v]) => `[${String(k)}, ${String(v)}]`).join(", ")})`; | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "MutableHashMap", | ||
values: Array.from(this) | ||
_id: "MutableHashMap", | ||
values: Array.from(this).map(_Inspectable.toJSON) | ||
}; | ||
@@ -34,0 +34,0 @@ }, |
@@ -24,8 +24,8 @@ "use strict"; | ||
toString() { | ||
return `MutableHashSet(${Array.from(this).map(String).join(", ")})`; | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "MutableHashSet", | ||
values: Array.from(this) | ||
_id: "MutableHashSet", | ||
values: Array.from(this).map(_Inspectable.toJSON) | ||
}; | ||
@@ -32,0 +32,0 @@ }, |
@@ -50,8 +50,8 @@ "use strict"; | ||
toString() { | ||
return `MutableList(${Array.from(this).map(String).join(", ")})`; | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "MutableList", | ||
values: Array.from(this) | ||
_id: "MutableList", | ||
values: Array.from(this).map(_Inspectable.toJSON) | ||
}; | ||
@@ -58,0 +58,0 @@ }, |
@@ -31,8 +31,8 @@ "use strict"; | ||
toString() { | ||
return `MutableQueue(${Array.from(this).map(String).join(", ")})`; | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "MutableQueue", | ||
values: Array.from(this) | ||
_id: "MutableQueue", | ||
values: Array.from(this).map(_Inspectable.toJSON) | ||
}; | ||
@@ -39,0 +39,0 @@ }, |
@@ -21,8 +21,8 @@ "use strict"; | ||
toString() { | ||
return `MutableRef(${String(this.current)})`; | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "MutableRef", | ||
current: this.current | ||
_id: "MutableRef", | ||
current: (0, _Inspectable.toJSON)(this.current) | ||
}; | ||
@@ -29,0 +29,0 @@ }, |
{ | ||
"name": "@effect/data", | ||
"version": "0.18.4", | ||
"version": "0.18.5", | ||
"description": "Functional programming in TypeScript", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -345,2 +345,19 @@ import type { TypeLambda } from "@effect/data/HKT"; | ||
/** | ||
* A guard that succeeds when the input is a `Uint8Array`. | ||
* | ||
* @param input - The value to test. | ||
* | ||
* @example | ||
* import { isUint8Array } from "@effect/data/Predicate" | ||
* | ||
* assert.deepStrictEqual(isUint8Array(new Uint8Array()), true) | ||
* | ||
* assert.deepStrictEqual(isUint8Array(null), false) | ||
* assert.deepStrictEqual(isUint8Array({}), false) | ||
* | ||
* @category guards | ||
* @since 1.0.0 | ||
*/ | ||
export declare const isUint8Array: (input: unknown) => input is Uint8Array; | ||
/** | ||
* A guard that succeeds when the input is a `Date`. | ||
@@ -347,0 +364,0 @@ * |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.xor = exports.tuple = exports.struct = exports.some = exports.productMany = exports.product = exports.or = exports.not = exports.nor = exports.nand = exports.mapInput = exports.isUnknown = exports.isUndefined = exports.isTagged = exports.isSymbol = exports.isString = exports.isRecord = exports.isReadonlyRecord = exports.isObject = exports.isNumber = exports.isNullable = exports.isNull = exports.isNotUndefined = exports.isNotNullable = exports.isNotNull = exports.isNever = exports.isIterable = exports.isFunction = exports.isError = exports.isDate = exports.isBoolean = exports.isBigint = exports.implies = exports.every = exports.eqv = exports.compose = exports.and = exports.all = void 0; | ||
exports.xor = exports.tuple = exports.struct = exports.some = exports.productMany = exports.product = exports.or = exports.not = exports.nor = exports.nand = exports.mapInput = exports.isUnknown = exports.isUndefined = exports.isUint8Array = exports.isTagged = exports.isSymbol = exports.isString = exports.isRecord = exports.isReadonlyRecord = exports.isObject = exports.isNumber = exports.isNullable = exports.isNull = exports.isNotUndefined = exports.isNotNullable = exports.isNotNull = exports.isNever = exports.isIterable = exports.isFunction = exports.isError = exports.isDate = exports.isBoolean = exports.isBigint = exports.implies = exports.every = exports.eqv = exports.compose = exports.and = exports.all = void 0; | ||
var _Function = /*#__PURE__*/require("@effect/data/Function"); | ||
@@ -342,2 +342,20 @@ /** | ||
/** | ||
* A guard that succeeds when the input is a `Uint8Array`. | ||
* | ||
* @param input - The value to test. | ||
* | ||
* @example | ||
* import { isUint8Array } from "@effect/data/Predicate" | ||
* | ||
* assert.deepStrictEqual(isUint8Array(new Uint8Array()), true) | ||
* | ||
* assert.deepStrictEqual(isUint8Array(null), false) | ||
* assert.deepStrictEqual(isUint8Array({}), false) | ||
* | ||
* @category guards | ||
* @since 1.0.0 | ||
*/ | ||
exports.isError = isError; | ||
const isUint8Array = input => input instanceof Uint8Array; | ||
/** | ||
* A guard that succeeds when the input is a `Date`. | ||
@@ -358,3 +376,3 @@ * | ||
*/ | ||
exports.isError = isError; | ||
exports.isUint8Array = isUint8Array; | ||
const isDate = input => input instanceof Date; | ||
@@ -361,0 +379,0 @@ /** |
@@ -34,8 +34,8 @@ "use strict"; | ||
toString() { | ||
return `SortedMap(${Array.from(this).map(([k, v]) => `[${String(k)}, ${String(v)}]`).join(", ")})`; | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "SortedMap", | ||
values: Array.from(this) | ||
_id: "SortedMap", | ||
values: Array.from(this).map(_Inspectable.toJSON) | ||
}; | ||
@@ -42,0 +42,0 @@ }, |
@@ -35,8 +35,8 @@ "use strict"; | ||
toString() { | ||
return JSON.stringify(this, null, 2); | ||
return (0, _Inspectable.toString)(this.toJSON()); | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "SortedSet", | ||
values: Array.from(this) | ||
_id: "SortedSet", | ||
values: Array.from(this).map(_Inspectable.toJSON) | ||
}; | ||
@@ -43,0 +43,0 @@ }, |
@@ -10,3 +10,3 @@ /** | ||
import type { TypeLambda } from "@effect/data/HKT" | ||
import { type Inspectable, NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { type Inspectable, NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import type { NonEmptyIterable } from "@effect/data/NonEmptyIterable" | ||
@@ -129,8 +129,8 @@ import type { Option } from "@effect/data/Option" | ||
toString<A>(this: Chunk<A>) { | ||
return `Chunk(${toReadonlyArray(this).map(String).join(", ")})` | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON<A>(this: Chunk<A>) { | ||
return { | ||
_tag: "Chunk", | ||
values: toReadonlyArray(this) | ||
_id: "Chunk", | ||
values: toReadonlyArray(this).map(toJSON) | ||
} | ||
@@ -137,0 +137,0 @@ }, |
@@ -9,3 +9,3 @@ /** | ||
import type { Inspectable } from "@effect/data/Inspectable" | ||
import { NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { NodeInspectSymbol, toString } from "@effect/data/Inspectable" | ||
import * as Option from "@effect/data/Option" | ||
@@ -122,24 +122,14 @@ import * as order from "@effect/data/Order" | ||
toString(this: Duration) { | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON(this: Duration) { | ||
switch (this.value._tag) { | ||
case "Millis": | ||
return `Duration("${this.value.millis} millis")` | ||
return { _id: "Duration", _tag: "Millis", millis: this.value.millis } | ||
case "Nanos": | ||
return `Duration("${this.value.nanos} nanos")` | ||
return { _id: "Duration", _tag: "Nanos", hrtime: toHrTime(this) } | ||
case "Infinity": | ||
return "Duration(Infinity)" | ||
return { _id: "Duration", _tag: "Infinity" } | ||
} | ||
}, | ||
toJSON(this: Duration) { | ||
if (this.value._tag === "Nanos") { | ||
return { | ||
_tag: "Duration", | ||
value: { _tag: "Nanos", hrtime: toHrTime(this) } | ||
} | ||
} | ||
return { | ||
_tag: "Duration", | ||
value: this.value | ||
} | ||
}, | ||
[NodeInspectSymbol]() { | ||
@@ -146,0 +136,0 @@ return this.toJSON() |
@@ -26,6 +26,2 @@ /** | ||
export function equals<B>(that: B): <A>(self: A) => boolean | ||
/** | ||
* @since 1.0.0 | ||
* @category equality | ||
*/ | ||
export function equals<A, B>(self: A, that: B): boolean | ||
@@ -69,3 +65,2 @@ export function equals(): any { | ||
*/ | ||
export const equivalence: <A>() => Equivalence<A> = () => (self, that) => | ||
Hash.hash(self) === Hash.hash(that) && equals(self, that) | ||
export const equivalence: <A>() => Equivalence<A> = () => (self, that) => equals(self, that) |
@@ -26,1 +26,21 @@ /** | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export const toJSON = (x: unknown): unknown => { | ||
if ( | ||
typeof x === "object" && x !== null && "toJSON" in x && typeof x["toJSON"] === "function" && | ||
x["toJSON"].length === 0 | ||
) { | ||
return x.toJSON() | ||
} else if (Array.isArray(x)) { | ||
return x.map(toJSON) | ||
} | ||
return x | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export const toString = (x: unknown): string => JSON.stringify(x, null, 2) |
@@ -6,3 +6,3 @@ import type * as C from "@effect/data/Context" | ||
import * as Hash from "@effect/data/Hash" | ||
import { NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import { type Effectable, EffectTypeId, effectVariance } from "@effect/data/internal/Effect" | ||
@@ -31,7 +31,7 @@ import type * as O from "@effect/data/Option" | ||
toString() { | ||
return JSON.stringify(this, null, 2) | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON<I, A>(this: C.Tag<I, A>) { | ||
return { | ||
_tag: "Tag", | ||
_id: "Tag", | ||
identifier: this.identifier, | ||
@@ -110,8 +110,8 @@ stack: this.stack | ||
toString() { | ||
return JSON.stringify(this, null, 2) | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON<A>(this: C.Context<A>) { | ||
return { | ||
_tag: "Context", | ||
services: Array.from(this.unsafeMap) | ||
_id: "Context", | ||
services: Array.from(this.unsafeMap).map(toJSON) | ||
} | ||
@@ -118,0 +118,0 @@ }, |
@@ -9,3 +9,3 @@ /** | ||
import * as Hash from "@effect/data/Hash" | ||
import { NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import { EffectTypeId, effectVariance } from "@effect/data/internal/Effect" | ||
@@ -27,3 +27,3 @@ import * as option from "@effect/data/internal/Option" | ||
[NodeInspectSymbol]<E, A>(this: Either.Either<E, A>) { | ||
return (this as any).toJSON() | ||
return this.toJSON() | ||
}, | ||
@@ -34,3 +34,3 @@ pipe() { | ||
toString<E, A>(this: Either.Left<E, A>) { | ||
return JSON.stringify(this, null, 2) | ||
return toString(this.toJSON()) | ||
} | ||
@@ -49,4 +49,5 @@ } | ||
return { | ||
_id: "Either", | ||
_tag: this._tag, | ||
right: this.right | ||
right: toJSON(this.right) | ||
} | ||
@@ -66,4 +67,5 @@ } | ||
return { | ||
_id: "Either", | ||
_tag: this._tag, | ||
left: this.left | ||
left: toJSON(this.left) | ||
} | ||
@@ -70,0 +72,0 @@ } |
@@ -6,3 +6,3 @@ import * as Equal from "@effect/data/Equal" | ||
import type * as HM from "@effect/data/HashMap" | ||
import { NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import { fromBitmap, hashFragment, toBitmap } from "@effect/data/internal/HashMap/bitwise" | ||
@@ -78,8 +78,8 @@ import { SIZE } from "@effect/data/internal/HashMap/config" | ||
toString<K, V>(this: HashMapImpl<K, V>) { | ||
return `HashMap(${Array.from(this).map(([k, v]) => `[${String(k)}, ${String(v)}]`).join(", ")})` | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "HashMap", | ||
values: Array.from(this) | ||
_id: "HashMap", | ||
values: Array.from(this).map(toJSON) | ||
} | ||
@@ -86,0 +86,0 @@ }, |
@@ -6,3 +6,3 @@ import * as Equal from "@effect/data/Equal" | ||
import type * as HS from "@effect/data/HashSet" | ||
import { NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import * as HM from "@effect/data/internal/HashMap" | ||
@@ -39,8 +39,8 @@ import { pipeArguments } from "@effect/data/Pipeable" | ||
toString() { | ||
return `HashSet(${Array.from(this).map(String).join(", ")})` | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "HashSet", | ||
values: Array.from(this) | ||
_id: "HashSet", | ||
values: Array.from(this).map(toJSON) | ||
} | ||
@@ -47,0 +47,0 @@ }, |
@@ -7,3 +7,3 @@ /** | ||
import * as Hash from "@effect/data/Hash" | ||
import { NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import { EffectTypeId, effectVariance } from "@effect/data/internal/Effect" | ||
@@ -27,3 +27,3 @@ import type * as Option from "@effect/data/Option" | ||
toString<A>(this: Option.Option<A>) { | ||
return JSON.stringify(this, null, 2) | ||
return toString(this.toJSON()) | ||
} | ||
@@ -42,4 +42,5 @@ } | ||
return { | ||
_id: "Option", | ||
_tag: this._tag, | ||
value: this.value | ||
value: toJSON(this.value) | ||
} | ||
@@ -59,2 +60,3 @@ } | ||
return { | ||
_id: "Option", | ||
_tag: this._tag | ||
@@ -61,0 +63,0 @@ } |
@@ -5,3 +5,3 @@ import * as Chunk from "@effect/data/Chunk" | ||
import * as Hash from "@effect/data/Hash" | ||
import { NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import { Direction, RedBlackTreeIterator } from "@effect/data/internal/RedBlackTree/iterator" | ||
@@ -52,8 +52,8 @@ import * as Node from "@effect/data/internal/RedBlackTree/node" | ||
toString() { | ||
return `RedBlackTree(${Array.from(this).map(([k, v]) => `[${String(k)}, ${String(v)}]`).join(", ")})` | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "RedBlackTree", | ||
values: Array.from(this) | ||
_id: "RedBlackTree", | ||
values: Array.from(this).map(toJSON) | ||
} | ||
@@ -60,0 +60,0 @@ }, |
@@ -30,3 +30,3 @@ /** | ||
import * as Hash from "@effect/data/Hash" | ||
import { type Inspectable, NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { type Inspectable, NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import * as Option from "@effect/data/Option" | ||
@@ -104,11 +104,12 @@ import type { Pipeable } from "@effect/data/Pipeable" | ||
toString(this: Cons<unknown>) { | ||
return `List.Cons(${toReadonlyArray(this).map(String).join(", ")})` | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON(this: Cons<unknown>) { | ||
return { | ||
_tag: "List.Cons", | ||
values: toReadonlyArray(this) | ||
_id: "List", | ||
_tag: "Cons", | ||
values: toReadonlyArray(this).map(toJSON) | ||
} | ||
}, | ||
[NodeInspectSymbol](this: any) { | ||
[NodeInspectSymbol]() { | ||
return this.toJSON() | ||
@@ -170,7 +171,8 @@ }, | ||
toString() { | ||
return `List.Nil` | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "List.Nil" | ||
_id: "List", | ||
_tag: "Nil" | ||
} | ||
@@ -177,0 +179,0 @@ }, |
@@ -6,3 +6,3 @@ /** | ||
import * as HashMap from "@effect/data/HashMap" | ||
import { type Inspectable, NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { type Inspectable, NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import * as MutableRef from "@effect/data/MutableRef" | ||
@@ -38,8 +38,8 @@ import * as Option from "@effect/data/Option" | ||
toString() { | ||
return `MutableHashMap(${Array.from(this).map(([k, v]) => `[${String(k)}, ${String(v)}]`).join(", ")})` | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "MutableHashMap", | ||
values: Array.from(this) | ||
_id: "MutableHashMap", | ||
values: Array.from(this).map(toJSON) | ||
} | ||
@@ -46,0 +46,0 @@ }, |
@@ -5,3 +5,3 @@ /** | ||
import * as Dual from "@effect/data/Function" | ||
import { type Inspectable, NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { type Inspectable, NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import * as MutableHashMap from "@effect/data/MutableHashMap" | ||
@@ -36,8 +36,8 @@ import type { Pipeable } from "@effect/data/Pipeable" | ||
toString() { | ||
return `MutableHashSet(${Array.from(this).map(String).join(", ")})` | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "MutableHashSet", | ||
values: Array.from(this) | ||
_id: "MutableHashSet", | ||
values: Array.from(this).map(toJSON) | ||
} | ||
@@ -44,0 +44,0 @@ }, |
@@ -5,3 +5,3 @@ /** | ||
import * as Dual from "@effect/data/Function" | ||
import { NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import type { Inspectable } from "@effect/data/Inspectable" | ||
@@ -59,8 +59,8 @@ import type { Pipeable } from "@effect/data/Pipeable" | ||
toString() { | ||
return `MutableList(${Array.from(this).map(String).join(", ")})` | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "MutableList", | ||
values: Array.from(this) | ||
_id: "MutableList", | ||
values: Array.from(this).map(toJSON) | ||
} | ||
@@ -67,0 +67,0 @@ }, |
@@ -6,3 +6,3 @@ /** | ||
import * as Dual from "@effect/data/Function" | ||
import { type Inspectable, NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { type Inspectable, NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import * as MutableList from "@effect/data/MutableList" | ||
@@ -55,8 +55,8 @@ import type { Pipeable } from "@effect/data/Pipeable" | ||
toString() { | ||
return `MutableQueue(${Array.from(this).map(String).join(", ")})` | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "MutableQueue", | ||
values: Array.from(this) | ||
_id: "MutableQueue", | ||
values: Array.from(this).map(toJSON) | ||
} | ||
@@ -63,0 +63,0 @@ }, |
@@ -6,3 +6,3 @@ /** | ||
import * as Dual from "@effect/data/Function" | ||
import { type Inspectable, NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { type Inspectable, NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import type { Pipeable } from "@effect/data/Pipeable" | ||
@@ -33,8 +33,8 @@ import { pipeArguments } from "@effect/data/Pipeable" | ||
toString<A>(this: MutableRef<A>): string { | ||
return `MutableRef(${String(this.current)})` | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON<A>(this: MutableRef<A>) { | ||
return { | ||
_tag: "MutableRef", | ||
current: this.current | ||
_id: "MutableRef", | ||
current: toJSON(this.current) | ||
} | ||
@@ -41,0 +41,0 @@ }, |
@@ -372,2 +372,20 @@ /** | ||
/** | ||
* A guard that succeeds when the input is a `Uint8Array`. | ||
* | ||
* @param input - The value to test. | ||
* | ||
* @example | ||
* import { isUint8Array } from "@effect/data/Predicate" | ||
* | ||
* assert.deepStrictEqual(isUint8Array(new Uint8Array()), true) | ||
* | ||
* assert.deepStrictEqual(isUint8Array(null), false) | ||
* assert.deepStrictEqual(isUint8Array({}), false) | ||
* | ||
* @category guards | ||
* @since 1.0.0 | ||
*/ | ||
export const isUint8Array = (input: unknown): input is Uint8Array => input instanceof Uint8Array | ||
/** | ||
* A guard that succeeds when the input is a `Date`. | ||
@@ -374,0 +392,0 @@ * |
@@ -8,3 +8,3 @@ /** | ||
import * as Hash from "@effect/data/Hash" | ||
import { type Inspectable, NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { type Inspectable, NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import * as Option from "@effect/data/Option" | ||
@@ -47,8 +47,8 @@ import type { Order } from "@effect/data/Order" | ||
toString() { | ||
return `SortedMap(${Array.from(this).map(([k, v]) => `[${String(k)}, ${String(v)}]`).join(", ")})` | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "SortedMap", | ||
values: Array.from(this) | ||
_id: "SortedMap", | ||
values: Array.from(this).map(toJSON) | ||
} | ||
@@ -55,0 +55,0 @@ }, |
@@ -9,3 +9,3 @@ /** | ||
import type { Inspectable } from "@effect/data/Inspectable" | ||
import { NodeInspectSymbol } from "@effect/data/Inspectable" | ||
import { NodeInspectSymbol, toJSON, toString } from "@effect/data/Inspectable" | ||
import type { Order } from "@effect/data/Order" | ||
@@ -52,8 +52,8 @@ import type { Pipeable } from "@effect/data/Pipeable" | ||
toString<A>(this: SortedSet<A>) { | ||
return JSON.stringify(this, null, 2) | ||
return toString(this.toJSON()) | ||
}, | ||
toJSON() { | ||
return { | ||
_tag: "SortedSet", | ||
values: Array.from(this) | ||
_id: "SortedSet", | ||
values: Array.from(this).map(toJSON) | ||
} | ||
@@ -60,0 +60,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
3021956
64212