Comparing version 0.13.0 to 0.14.0
@@ -1,2 +0,2 @@ | ||
export declare const arkUtilVersion = "0.13.0"; | ||
export declare const arkUtilVersion = "0.14.0"; | ||
export declare const initialRegistryContents: { | ||
@@ -3,0 +3,0 @@ version: string; |
@@ -8,3 +8,3 @@ import { domainOf } from "./domain.js"; | ||
// For now, we assert this matches the package.json version via a unit test. | ||
export const arkUtilVersion = "0.13.0"; | ||
export const arkUtilVersion = "0.14.0"; | ||
export const initialRegistryContents = { | ||
@@ -11,0 +11,0 @@ version: arkUtilVersion, |
@@ -8,2 +8,3 @@ import type { array } from "./arrays.ts"; | ||
onUndefined?: string; | ||
onBigInt?: (value: bigint) => string; | ||
}; | ||
@@ -23,3 +24,3 @@ export type Json = JsonObject | JsonArray; | ||
}; | ||
type snapshotPrimitive<t> = t extends undefined ? "(undefined)" : t extends bigint ? `${t}n` : t extends symbol ? `Symbol(${string})` : t; | ||
type snapshotPrimitive<t> = t extends symbol ? `(Symbol${string})` : t; | ||
export declare const print: (data: unknown, indent?: number) => void; | ||
@@ -26,0 +27,0 @@ export declare const printable: (data: unknown, indent?: number) => string; |
import { domainOf } from "./domain.js"; | ||
import { serializePrimitive } from "./primitive.js"; | ||
import { register } from "./registry.js"; | ||
export const snapshot = (data, opts = { onUndefined: "(undefined)" }) => _serialize(data, opts, []); | ||
export const snapshot = (data, opts = {}) => _serialize(data, { | ||
onUndefined: `$ark.undefined`, | ||
onBigInt: n => `$ark.bigint-${n}`, | ||
...opts | ||
}, []); | ||
export const print = (data, indent) => console.log(printable(data, indent)); | ||
@@ -50,3 +54,3 @@ export const printable = (data, indent) => { | ||
case "bigint": | ||
return `${data}n`; | ||
return opts.onBigInt?.(data) ?? `${data}n`; | ||
case "undefined": | ||
@@ -53,0 +57,0 @@ return opts.onUndefined ?? "undefined"; |
{ | ||
"name": "@ark/util", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "David Blass", |
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
90377
1936