From 82d727cc744b4b2e6634e76f2aa2ba1114b713f6 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Thu, 16 Oct 2025 09:54:48 -0700 Subject: [PATCH] Update value.ts --- src/value.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/value.ts b/src/value.ts index 273875f..035f036 100644 --- a/src/value.ts +++ b/src/value.ts @@ -11,13 +11,13 @@ export type Value = | { type: 'function', params: string[], - defaults: Record, // indices into constants + defaults: Record, // indices into constants body: number, parentScope: Scope, variadic: boolean, named: boolean, value: '' - } + } export type Dict = Map @@ -31,13 +31,17 @@ export type FunctionDef = { } export function toValue(v: any): Value /* throws */ { - if (v === null || v === undefined) return { type: 'null', value: null } + if (v === null || v === undefined) + return { type: 'null', value: null } - if (v && typeof v === 'object' && 'type' in v && 'value' in v) return v as Value + if (v && typeof v === 'object' && 'type' in v && 'value' in v) + return v as Value - if (Array.isArray(v)) return { type: 'array', value: v.map(toValue) } + if (Array.isArray(v)) + return { type: 'array', value: v.map(toValue) } - if (v instanceof RegExp) return { type: 'regex', value: v } + if (v instanceof RegExp) + return { type: 'regex', value: v } switch (typeof v) { case 'boolean':