INNER CODE UNIT · TypeScript
isBigMapPayload
f5/unovis · packages/mcp/src/codegen/index.ts:80
const isBigMapPayload = (value: unknown): boolean =>
typeof value === 'object' && value !== null && 'objects' in (value as Record<string, unknown>)
function addHelper (emit: Emit, code: string): void {
if (!emit.helpers.includes(code)) emit.helpers.push(code)
}
/** An accessor descriptor as a source expression */
function accessorExpression (ref: AccessorRef, emit: Emit): string {
if ('$field' in ref) {
const access = `d.${/^[A-Za-z_$][\w$]*$/.test(ref.$field) ? ref.$field : `['${ref.$field}']`}`
if (ref.as === 'date') return `d => new Date(${access}).getTime()`
return `d => ${access}`
}
if ('$index' in ref) return '(d, i) => i'
if ('$const' in ref) return `() => ${json(ref.$const)}`
if ('$numTickFormat' in ref) {
addHelper(emit, "const formatNumber = (value: number | Date): string =>\n Number(value).toLocaleString('en-US', { maximumFractionDigits: 6 })")