@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
25 lines • 1.63 kB
TypeScript
import type { JsonObject } from '../types.ts';
/** A JSON object, excluding null and arrays. */
export declare function isRecord(value: unknown): value is JsonObject;
/**
* A document mapping, not merely an object: only an object literal or
* `Object.create(null)`. A Set, a Date or any class instance has no own
* enumerable string keys, so `Object.entries` would read one as an empty
* mapping, and a live object a config holds (a client someone built)
* would lose its prototype if rebuilt from its entries. Python asks
* `isinstance(value, Mapping)`, which an instance already fails.
*/
export declare function isPlainObject(value: unknown): value is JsonObject;
export declare function asObject(value: unknown): JsonObject;
export declare function asArray(value: unknown): unknown[];
export declare function records(value: unknown): JsonObject[];
/** First string field, including an explicitly empty string. */
export declare function pickString(record: JsonObject, ...keys: readonly string[]): string | null;
export declare function stringOf(record: JsonObject, key: string): string;
/** First nonempty string, for labels whose empty spelling means absent. */
export declare function firstText(record: JsonObject, ...keys: readonly string[]): string;
export declare function pickBoolOrNull(record: JsonObject, key: string): boolean | null;
export declare function pickNumberOrNull(record: JsonObject, key: string): number | null;
export declare function pickStringArray(record: JsonObject, key: string): string[];
export declare function requireId(record: JsonObject): string;
//# sourceMappingURL=records.d.ts.map