Skip to content

std/build/json

std/build/json

Type Aliases

JsonPatchOperation

type JsonPatchOperation = Schema.Schema.Type<typeof JsonPatchOperationSchema>;

Defined in: apps/website/.api-docs-entry/std/build/json/index.d.ts:32

Variables

decodeNumber

const decodeNumber: (value) => number;

Defined in: apps/website/.api-docs-entry/std/build/json/index.d.ts:20

Decode a wire/form value as a number. Invalid input is NaN, the same as Number('x'), so existing callers that already branch on Number.isFinite keep their control flow.

Declared here rather than in a sibling file: tests/core.test.ts imports this module as TypeScript source, and Node's type stripping does not rewrite a ./number.js specifier to the .ts that exists. Every other source-imported module in this package is a single file for the same reason.

Parameters

Parameter Type
value unknown

Returns

number


JsonPatchOperationSchema

const JsonPatchOperationSchema: Schema.Struct<{
  op: Schema.Literals<readonly ["add", "remove", "replace"]>;
  path: Schema.String;
  value: Schema.optional<Schema.Unknown>;
}>;

Defined in: apps/website/.api-docs-entry/std/build/json/index.d.ts:27

One mutation in a JSON Patch document, as deepDiff and the form engine's delta carry it.

The wire shape has one schema owner so both producers and consumers agree on the op names — a move or copy op drifts out of the form engine's vocabulary and back in as a misapplied diff.


NumberFromUnknown

const NumberFromUnknown: Schema.Union<readonly [Schema.Number, Schema.compose<Schema.NumberFromString, Schema.String>]>;

Defined in: apps/website/.api-docs-entry/std/build/json/index.d.ts:10

Number or numeric string, the decode Number(input) was standing in for.

The blank string is refused rather than decoded. Schema.NumberFromString follows Number('') and answers 0, which is the one coercion no caller here wants: an empty numeric field is a value nobody entered, and rendering it as 0 states an amount the record does not hold. It read as a plain zero in a payroll figure.

Functions

deepDiff()

function deepDiff(
   a,
   b,
   basePath?): object[];

Defined in: apps/website/.api-docs-entry/std/build/json/index.d.ts:41

Parameters

Parameter Type
a unknown
b unknown
basePath? string

Returns

object[]


safeParse()

function safeParse(json): unknown;

Defined in: apps/website/.api-docs-entry/std/build/json/index.d.ts:40

Parse a JSON string, returning null on failure.

Returns unknown — callers must decode the result with an Effect Schema before treating it as a concrete type. This is the unvalidated boundary parse; structured validation belongs at the call site.

Parameters

Parameter Type
json string

Returns

unknown