@mojir/lits 2.2.3 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -8
- package/dist/cli/cli.js +1264 -909
- package/dist/cli/src/Lits/Lits.d.ts +8 -2
- package/dist/cli/src/builtin/bindingNode.d.ts +2 -1
- package/dist/cli/src/builtin/interface.d.ts +3 -2
- package/dist/cli/src/builtin/modules/number-theory/sequences/index.d.ts +2 -1
- package/dist/cli/src/evaluator/functionExecutors.d.ts +2 -1
- package/dist/cli/src/evaluator/index.d.ts +3 -2
- package/dist/cli/src/evaluator/interface.d.ts +3 -2
- package/dist/cli/src/utils/maybePromise.d.ts +54 -0
- package/dist/full.esm.js +1 -1
- package/dist/full.esm.js.map +1 -1
- package/dist/full.js +1 -1
- package/dist/full.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +1 -1
- package/dist/lits.iife.js.map +1 -1
- package/dist/modules/assert.esm.js +1 -1
- package/dist/modules/assert.esm.js.map +1 -1
- package/dist/modules/assert.js +1 -1
- package/dist/modules/assert.js.map +1 -1
- package/dist/modules/collection.esm.js +1 -1
- package/dist/modules/collection.esm.js.map +1 -1
- package/dist/modules/collection.js +1 -1
- package/dist/modules/collection.js.map +1 -1
- package/dist/modules/grid.esm.js +1 -1
- package/dist/modules/grid.esm.js.map +1 -1
- package/dist/modules/grid.js +1 -1
- package/dist/modules/grid.js.map +1 -1
- package/dist/modules/number-theory.esm.js +1 -1
- package/dist/modules/number-theory.esm.js.map +1 -1
- package/dist/modules/number-theory.js +1 -1
- package/dist/modules/number-theory.js.map +1 -1
- package/dist/modules/sequence.esm.js +1 -1
- package/dist/modules/sequence.esm.js.map +1 -1
- package/dist/modules/sequence.js +1 -1
- package/dist/modules/sequence.js.map +1 -1
- package/dist/modules/src/Lits/Lits.d.ts +8 -2
- package/dist/modules/src/builtin/bindingNode.d.ts +2 -1
- package/dist/modules/src/builtin/interface.d.ts +3 -2
- package/dist/modules/src/builtin/modules/number-theory/sequences/index.d.ts +2 -1
- package/dist/modules/src/evaluator/functionExecutors.d.ts +2 -1
- package/dist/modules/src/evaluator/index.d.ts +3 -2
- package/dist/modules/src/evaluator/interface.d.ts +3 -2
- package/dist/modules/src/utils/maybePromise.d.ts +54 -0
- package/dist/modules/vector.esm.js +1 -1
- package/dist/modules/vector.esm.js.map +1 -1
- package/dist/modules/vector.js +1 -1
- package/dist/modules/vector.js.map +1 -1
- package/dist/src/Lits/Lits.d.ts +8 -2
- package/dist/src/builtin/bindingNode.d.ts +2 -1
- package/dist/src/builtin/interface.d.ts +3 -2
- package/dist/src/builtin/modules/number-theory/sequences/index.d.ts +2 -1
- package/dist/src/evaluator/functionExecutors.d.ts +2 -1
- package/dist/src/evaluator/index.d.ts +3 -2
- package/dist/src/evaluator/interface.d.ts +3 -2
- package/dist/src/utils/maybePromise.d.ts +54 -0
- package/dist/testFramework.esm.js +1 -1
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +1 -1
- package/dist/testFramework.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.js","sources":["../../src/utils/debug/getCodeMarker.ts","../../src/errors.ts","../../src/constants/constants.ts","../../src/utils/symbols.ts","../../src/utils/debug/debugTools.ts","../../src/utils/debug/getSourceCodeInfo.ts","../../src/utils/getAssertionError.ts","../../src/typeGuards/litsFunction.ts","../../src/typeGuards/lits.ts","../../src/typeGuards/number.ts","../../src/typeGuards/string.ts","../../src/utils/index.ts","../../src/typeGuards/array.ts","../../src/utils/arity.ts","../../src/builtin/modules/collection/index.ts"],"sourcesContent":["import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getCodeMarker(sourceCodeInfo: SourceCodeInfo): string {\n if (!sourceCodeInfo.position || !sourceCodeInfo.code)\n return ''\n\n const leftPadding = sourceCodeInfo.position.column - 1\n const rightPadding = sourceCodeInfo.code.length - leftPadding - 1\n return `${' '.repeat(Math.max(leftPadding, 0))}^${' '.repeat(Math.max(rightPadding, 0))}`\n}\n","import { getCodeMarker } from '../src/utils/debug/getCodeMarker'\nimport type { Arr } from './interface'\nimport type { SourceCodeInfo } from './tokenizer/token'\n\nfunction getLitsErrorMessage(message: string, sourceCodeInfo?: SourceCodeInfo) {\n if (!sourceCodeInfo) {\n return message\n }\n const location = `${sourceCodeInfo.position.line}:${sourceCodeInfo.position.column}`\n const filePathLine = sourceCodeInfo.filePath\n ? `\\n${sourceCodeInfo.filePath}:${location}`\n : `\\nLocation ${location}`\n const codeLine = `\\n${sourceCodeInfo.code}`\n const codeMarker = `\\n${getCodeMarker(sourceCodeInfo)}`\n return `${message}${filePathLine}${codeLine}${codeMarker}`\n}\n\nexport class RecurSignal extends Error {\n public params: Arr\n constructor(params: Arr) {\n super(`recur, params: ${params}`)\n Object.setPrototypeOf(this, RecurSignal.prototype)\n this.name = 'RecurSignal'\n this.params = params\n }\n}\n\nexport class LitsError extends Error {\n public readonly sourceCodeInfo?: SourceCodeInfo\n public readonly shortMessage: string\n constructor(err: unknown, sourceCodeInfo: SourceCodeInfo | undefined) {\n const message = err instanceof Error\n ? err.message\n : `${err}`\n\n super(getLitsErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, LitsError.prototype)\n this.name = 'LitsError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends LitsError {\n public userMessage: string\n constructor(message: string, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n this.userMessage = message\n Object.setPrototypeOf(this, UserDefinedError.prototype)\n this.name = 'UserDefinedError'\n }\n}\n\nexport class AssertionError extends LitsError {\n constructor(message: string | Error, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n Object.setPrototypeOf(this, AssertionError.prototype)\n this.name = 'AssertionError'\n }\n}\n\nexport class UndefinedSymbolError extends LitsError {\n public symbol: string\n constructor(symbolName: string, sourceCodeInfo?: SourceCodeInfo) {\n const message = `Undefined symbol '${symbolName}'.`\n super(message, sourceCodeInfo)\n this.symbol = symbolName\n Object.setPrototypeOf(this, UndefinedSymbolError.prototype)\n this.name = 'UndefinedSymbolError'\n }\n}\n\nexport function isLitsError(error: unknown): error is LitsError {\n return error instanceof LitsError\n}\n","export const NodeTypes = {\n Number: 1,\n String: 2,\n NormalExpression: 3,\n SpecialExpression: 4,\n UserDefinedSymbol: 5,\n NormalBuiltinSymbol: 6,\n SpecialBuiltinSymbol: 7,\n ReservedSymbol: 8,\n Binding: 9,\n Spread: 10,\n} as const\n\nconst NodeTypesSet = new Set(Object.values(NodeTypes))\n\nexport type NodeType = typeof NodeTypes[keyof typeof NodeTypes]\n\nexport function getNodeTypeName(type: NodeType): keyof typeof NodeTypes {\n return Object.keys(NodeTypes).find(key => NodeTypes[key as keyof typeof NodeTypes] === type) as keyof typeof NodeTypes\n}\n\n// TODO, is this needed?\nexport function isNodeType(type: unknown): type is NodeType {\n return typeof type === 'number' && NodeTypesSet.has(type as NodeType)\n}\n\nconst functionTypes = [\n 'UserDefined',\n 'Partial',\n 'Comp',\n 'Constantly',\n 'Juxt',\n 'Complement',\n 'EveryPred',\n 'SomePred',\n 'Fnull',\n 'Builtin',\n 'SpecialBuiltin',\n 'NativeJsFunction',\n 'Module',\n] as const\n\nconst functionTypeSet = new Set(functionTypes)\n\nexport type FunctionType = typeof functionTypes[number]\n\nexport function isFunctionType(type: unknown): type is FunctionType {\n return typeof type === 'string' && functionTypeSet.has(type as FunctionType)\n}\n","export const FUNCTION_SYMBOL = '^^fn^^'\nexport const REGEXP_SYMBOL = '^^re^^'\n","import { getNodeTypeName, isFunctionType, isNodeType } from '../../constants/constants'\nimport type { AstNode, LitsFunction } from '../../parser/types'\nimport { FUNCTION_SYMBOL } from '../symbols'\n\nfunction isLitsFunction(func: unknown): func is LitsFunction {\n if (func === null || typeof func !== 'object')\n return false\n\n return FUNCTION_SYMBOL in func && 'functionType' in func && isFunctionType(func.functionType)\n}\n\nfunction isNode(value: unknown): value is AstNode {\n if (!Array.isArray(value) || value.length < 2)\n return false\n return isNodeType(value[0])\n}\n\nexport function valueToString(value: unknown): string {\n if (isLitsFunction(value))\n // eslint-disable-next-line ts/no-unsafe-member-access\n return `<function ${(value as any).name || '\\u03BB'}>`\n\n if (isNode(value))\n return `${getNodeTypeName(value[0])}-node`\n\n if (value === null)\n return 'null'\n\n if (typeof value === 'object' && value instanceof RegExp)\n return `${value}`\n\n if (typeof value === 'object' && value instanceof Error)\n return value.toString()\n\n return JSON.stringify(value)\n}\n","import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getSourceCodeInfo(anyValue: any, sourceCodeInfo: SourceCodeInfo | undefined): SourceCodeInfo | undefined {\n // eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access\n return anyValue?.sourceCodeInfo ?? sourceCodeInfo\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from './debug/debugTools'\nimport { getSourceCodeInfo } from './debug/getSourceCodeInfo'\n\nexport function getAssertionError(typeName: string, value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsError {\n return new LitsError(`Expected ${typeName}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo))\n}\n","import type { LitsFunction, NativeJsFunction, NormalBuiltinFunction, UserDefinedFunction } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { FUNCTION_SYMBOL } from '../utils/symbols'\nimport { isUnknownRecord } from '.'\n\nexport function isLitsFunction(value: unknown): value is LitsFunction {\n if (value === null || typeof value !== 'object')\n return false\n\n return !!(value as LitsFunction)[FUNCTION_SYMBOL]\n}\nexport function asLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsFunction {\n assertLitsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is LitsFunction {\n if (!isLitsFunction(value))\n throw getAssertionError('LitsFunction', value, sourceCodeInfo)\n}\n\nexport function isUserDefinedFunction(value: unknown): value is UserDefinedFunction {\n return isLitsFunction(value) && value.functionType === 'UserDefined'\n}\nexport function asUserDefinedFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): UserDefinedFunction {\n assertUserDefinedFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertUserDefinedFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is UserDefinedFunction {\n if (!isUserDefinedFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isNativeJsFunction(value: unknown): value is NativeJsFunction {\n return isLitsFunction(value) && value.functionType === 'NativeJsFunction'\n}\nexport function asNativeJsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): NativeJsFunction {\n assertNativeJsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertNativeJsFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is NativeJsFunction {\n if (!isNativeJsFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isBuiltinFunction(value: unknown): value is NormalBuiltinFunction {\n return isUnknownRecord(value) && value.functionType === 'Builtin'\n}\n","import type { Any, Coll, Obj, Seq } from '../interface'\nimport type { FunctionLike, RegularExpression } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { REGEXP_SYMBOL } from '../utils/symbols'\nimport { isLitsFunction } from './litsFunction'\n\nexport function isAny(value: unknown): value is Any {\n // TODO weak test\n return value !== undefined\n}\nexport function asAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): Any {\n assertAny(value, sourceCodeInfo)\n return value\n}\nexport function assertAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Any {\n if (!isAny(value))\n throw getAssertionError('not undefined', value, sourceCodeInfo)\n}\n\nexport function isSeq(value: unknown): value is Seq {\n return Array.isArray(value) || typeof value === 'string'\n}\nexport function asSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): Seq {\n assertSeq(value, sourceCodeInfo)\n return value\n}\nexport function assertSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Seq {\n if (!isSeq(value))\n throw getAssertionError('string or array', value, sourceCodeInfo)\n}\n\nexport function isObj(value: unknown): value is Obj {\n return !(\n value === null\n || typeof value !== 'object'\n || Array.isArray(value)\n || value instanceof RegExp\n || isLitsFunction(value)\n || isRegularExpression(value)\n )\n}\nexport function asObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): Obj {\n assertObj(value, sourceCodeInfo)\n return value\n}\nexport function assertObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Obj {\n if (!isObj(value))\n throw getAssertionError('object', value, sourceCodeInfo)\n}\n\nexport function isColl(value: unknown): value is Coll {\n return isSeq(value) || isObj(value)\n}\nexport function asColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): Coll {\n assertColl(value, sourceCodeInfo)\n return value\n}\nexport function assertColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Coll {\n if (!isColl(value))\n throw getAssertionError('string, array or object', value, sourceCodeInfo)\n}\n\nexport function isRegularExpression(regexp: unknown): regexp is RegularExpression {\n if (regexp === null || typeof regexp !== 'object')\n return false\n\n return !!(regexp as RegularExpression)[REGEXP_SYMBOL]\n}\nexport function asRegularExpression(value: unknown, sourceCodeInfo?: SourceCodeInfo): RegularExpression {\n assertRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is RegularExpression {\n if (!isRegularExpression(value))\n throw getAssertionError('RegularExpression', value, sourceCodeInfo)\n}\n\nexport function isStringOrRegularExpression(value: unknown): value is string | RegularExpression {\n return isRegularExpression(value) || typeof value === 'string'\n}\nexport function asStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): string | RegularExpression {\n assertStringOrRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | RegularExpression {\n if (!isStringOrRegularExpression(value))\n throw getAssertionError('string or RegularExpression', value, sourceCodeInfo)\n}\n\nfunction isFunctionLike(value: unknown): value is FunctionLike {\n if (typeof value === 'number')\n return true\n if (isColl(value))\n return true\n if (isLitsFunction(value))\n return true\n\n return false\n}\nexport function asFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): FunctionLike {\n assertFunctionLike(value, sourceCodeInfo)\n return value\n}\nexport function assertFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is FunctionLike {\n if (!isFunctionLike(value))\n throw getAssertionError('FunctionLike', value, sourceCodeInfo)\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\ntype SignOptions =\n | {\n positive?: true\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: true\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: true\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: true\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: true\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: true\n }\n\ntype GtOptions =\n | {\n gt?: number\n gte?: never\n }\n | {\n gt?: never\n gte?: number\n }\n\ntype LtOptions =\n | {\n lt?: number\n lte?: never\n }\n | {\n lt?: never\n lte?: number\n }\n\ntype NumberOptions = {\n integer?: true\n finite?: true\n} & SignOptions &\nGtOptions &\nLtOptions\n\nfunction getRangeString(options: NumberOptions): string {\n const hasUpperAndLowerBound\n = (typeof options.gt === 'number' || typeof options.gte === 'number')\n && (typeof options.lt === 'number' || typeof options.lte === 'number')\n if (hasUpperAndLowerBound) {\n return `${typeof options.gt === 'number' ? `${options.gt} < n ` : `${options.gte} <= n `}${\n typeof options.lt === 'number' ? `< ${options.lt}` : `<= ${options.lte}`\n }`\n }\n else if (typeof options.gt === 'number' || typeof options.gte === 'number') {\n return `${typeof options.gt === 'number' ? `n > ${options.gt}` : `n >= ${options.gte}`}`\n }\n else if (typeof options.lt === 'number' || typeof options.lte === 'number') {\n return `${typeof options.lt === 'number' ? `n < ${options.lt}` : `n <= ${options.lte}`}`\n }\n else { return '' }\n}\n\nfunction getSignString(options: NumberOptions): string {\n return options.positive\n ? 'positive'\n : options.negative\n ? 'negative'\n : options.nonNegative\n ? 'non negative'\n : options.nonPositive\n ? 'non positive'\n : options.nonZero\n ? 'non zero'\n : ''\n}\n\nfunction getNumberTypeName(options: NumberOptions): string {\n if (options.zero)\n return 'zero'\n\n const sign = getSignString(options)\n const numberType = options.integer ? 'integer' : 'number'\n const finite = options.finite ? 'finite' : ''\n const range = getRangeString(options)\n\n return [sign, finite, numberType, range].filter(x => !!x).join(' ')\n}\n\nexport function isNumber(value: unknown, options: NumberOptions = {}): value is number {\n if (typeof value !== 'number')\n return false\n\n if (Number.isNaN(value))\n return false\n\n if (options.integer && !Number.isInteger(value))\n return false\n\n if (options.finite && !Number.isFinite(value))\n return false\n\n if (options.zero && value !== 0)\n return false\n\n if (options.nonZero && value === 0)\n return false\n\n if (options.positive && value <= 0)\n return false\n\n if (options.negative && value >= 0)\n return false\n\n if (options.nonPositive && value > 0)\n return false\n\n if (options.nonNegative && value < 0)\n return false\n\n if (typeof options.gt === 'number' && value <= options.gt)\n return false\n\n if (typeof options.gte === 'number' && value < options.gte)\n return false\n\n if (typeof options.lt === 'number' && value >= options.lt)\n return false\n\n if (typeof options.lte === 'number' && value > options.lte)\n return false\n\n return true\n}\n\nexport function assertNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n options: NumberOptions = {},\n): asserts value is number {\n if (!isNumber(value, options)) {\n throw new LitsError(\n `Expected ${getNumberTypeName(options)}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asNumber(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: NumberOptions = {},\n): number {\n assertNumber(value, sourceCodeInfo, options)\n return value\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\ntype StringAssertionOptions =\n | {\n nonEmpty?: true\n char?: never\n }\n | {\n nonEmpty?: never\n char?: true\n }\n\nexport function isString(value: unknown, options: StringAssertionOptions = {}): value is string {\n if (typeof value !== 'string')\n return false\n\n if (options.nonEmpty && value.length === 0)\n return false\n\n if (options.char && value.length !== 1)\n return false\n\n return true\n}\n\nexport function assertString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): asserts value is string {\n if (!isString(value, options)) {\n throw getAssertionError(\n `${options.nonEmpty ? 'non empty string' : options.char ? 'character' : 'string'}`,\n value,\n sourceCodeInfo,\n )\n }\n}\n\nexport function asString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): string {\n assertString(value, sourceCodeInfo, options)\n return value\n}\n\nexport function isStringOrNumber(value: unknown): value is string | number {\n return typeof value === 'string' || typeof value === 'number'\n}\nexport function asStringOrNumber(value: unknown, sourceCodeInfo?: SourceCodeInfo): string | number {\n assertStringOrNumber(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | number {\n if (!isStringOrNumber(value))\n throw getAssertionError('string or number', value, sourceCodeInfo)\n}\n","import type { Any, Coll, Obj } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { asAny, isColl, isObj, isRegularExpression } from '../typeGuards/lits'\nimport { isNumber } from '../typeGuards/number'\nimport { asString, assertStringOrNumber } from '../typeGuards/string'\nimport { isUnknownRecord } from '../typeGuards'\nimport { LitsError } from '../errors'\n\nexport function collHasKey(coll: unknown, key: string | number): boolean {\n if (!isColl(coll))\n return false\n\n if (typeof coll === 'string' || Array.isArray(coll)) {\n if (!isNumber(key, { integer: true }))\n return false\n\n return key >= 0 && key < coll.length\n }\n return !!Object.getOwnPropertyDescriptor(coll, key)\n}\n\nexport function compare<T extends string | number>(a: T, b: T, sourceCodeInfo: SourceCodeInfo | undefined): number {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n\n if (typeof a === 'string' && typeof b === 'string') {\n return a < b ? -1 : a > b ? 1 : 0\n }\n if (typeof a === 'number' && typeof b === 'number') {\n return Math.sign((a) - (b))\n }\n throw new LitsError(`Cannot compare values of different types: ${typeof a} and ${typeof b}`, sourceCodeInfo)\n}\n\nexport function deepEqual(a: unknown, b: unknown, sourceCodeInfo?: SourceCodeInfo): boolean {\n if (a === b)\n return true\n\n if (typeof a === 'number' && typeof b === 'number')\n return approxEqual(a, b)\n\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length)\n return false\n\n for (let i = 0; i < a.length; i += 1) {\n if (!deepEqual(asAny(a[i], sourceCodeInfo), asAny(b[i], sourceCodeInfo), sourceCodeInfo))\n return false\n }\n return true\n }\n if (isRegularExpression(a) && isRegularExpression(b))\n return a.s === b.s && a.f === b.f\n\n if (isUnknownRecord(a) && isUnknownRecord(b)) {\n const aKeys = Object.keys(a)\n const bKeys = Object.keys(b)\n if (aKeys.length !== bKeys.length)\n return false\n\n for (let i = 0; i < aKeys.length; i += 1) {\n const key = asString(aKeys[i], sourceCodeInfo)\n if (!deepEqual(a[key], b[key], sourceCodeInfo))\n return false\n }\n return true\n }\n return false\n}\n\nexport function toNonNegativeInteger(num: number): number {\n return Math.max(0, Math.ceil(num))\n}\n\nexport function toAny(value: unknown): Any {\n return (value ?? null) as Any\n}\n\nfunction clone<T>(value: T): T {\n if (isObj(value)) {\n return Object.entries(value).reduce((result: Obj, entry) => {\n const [key, val] = entry\n result[key] = clone(val)\n return result\n }, {}) as T\n }\n if (Array.isArray(value))\n // eslint-disable-next-line ts/no-unsafe-return\n return value.map(item => clone(item)) as unknown as T\n\n return value\n}\n\nexport function cloneColl<T extends Coll>(value: T): T {\n return clone(value)\n}\n\nexport function joinSets<T>(...results: Set<T>[]): Set<T> {\n const result = new Set<T>()\n for (const symbols of results)\n symbols.forEach(symbol => result.add(symbol))\n\n return result\n}\n\nexport function addToSet<T>(target: Set<T>, source: Set<T>): void {\n source.forEach(symbol => target.add(symbol))\n}\n\nexport const EPSILON = 1e-10\n\nexport function approxEqual(a: number, b: number, epsilon: number = EPSILON): boolean {\n if (a === b) {\n return true\n }\n\n const diff = Math.abs(a - b)\n\n if (a === 0 || b === 0 || diff < epsilon) {\n // Use absolute error for values near zero\n return diff < epsilon\n }\n const absA = Math.abs(a)\n const absB = Math.abs(b)\n\n // Use relative error for larger values\n return diff / (absA + absB) < epsilon\n}\n\nexport function approxZero(value: number): boolean {\n return Math.abs(value) < EPSILON\n}\n\nexport function smartTrim(str: string, minIndent = 0): string {\n const lines = str.split('\\n')\n while (lines[0]?.match(/^\\s*$/)) {\n lines.shift() // Remove leading empty lines\n }\n while (lines[lines.length - 1]?.match(/^\\s*$/)) {\n lines.pop() // Remove trailing empty lines\n }\n const indent = lines.reduce((acc, line) => {\n if (line.match(/^\\s*$/))\n return acc // Skip empty lines\n const lineIndent = line.match(/^\\s*/)![0].length\n return Math.min(acc, lineIndent)\n }, Infinity)\n return lines.map(line => ' '.repeat(minIndent) + line.slice(indent)).join('\\n').trimEnd()\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\n// isArray not needed, use Array.isArary\nexport function asArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): unknown[] {\n assertArray(value, sourceCodeInfo)\n return value\n}\nexport function assertArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is unknown[] {\n if (!Array.isArray(value))\n throw getAssertionError('array', value, sourceCodeInfo)\n}\n\nexport function isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string')\n}\nexport function asStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertStringArray(value, sourceCodeInfo)\n return value\n}\nexport function assertStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isStringArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n\nexport function isCharArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string' && v.length === 1)\n}\nexport function asCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertCharArray(value, sourceCodeInfo)\n return value\n}\nexport function assertCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isCharArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n","import type { Arity } from '../builtin/interface'\nimport { LitsError } from '../errors'\nimport type { FunctionLike } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isColl } from '../typeGuards/lits'\nimport { valueToString } from './debug/debugTools'\n\nexport function arityAccepts(arity: Arity, nbrOfParams: number): boolean {\n const { min, max } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n if (typeof max === 'number' && nbrOfParams > max) {\n return false\n }\n return true\n}\n\nexport function arityAcceptsMin(arity: Arity, nbrOfParams: number): boolean {\n const { min } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n return true\n}\n\nexport function getCommonArityFromFunctions(params: FunctionLike[]): Arity | null {\n return params.reduce((acc: Arity | null, param): Arity | null => {\n if (acc === null) {\n return null\n }\n const arity: Arity = (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n const { min: aMin, max: aMax } = arity\n const { min: bMin, max: bMax } = acc\n const min = typeof aMin === 'number' && typeof bMin === 'number'\n ? Math.max(aMin, bMin)\n : typeof aMin === 'number' ? aMin : typeof bMin === 'number' ? bMin : undefined\n const max = typeof aMax === 'number' && typeof bMax === 'number'\n ? Math.min(aMax, bMax)\n : typeof aMax === 'number' ? aMax : typeof bMax === 'number' ? bMax : undefined\n\n if (typeof min === 'number' && typeof max === 'number' && min > max) {\n return null\n }\n\n return { min, max }\n }, {})\n}\n\nexport function getArityFromFunction(param: FunctionLike): Arity {\n return (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n}\n\nexport function assertNumberOfParams(arity: Arity, length: number, sourceCodeInfo: SourceCodeInfo | undefined): void {\n const { min, max } = arity\n if (typeof min === 'number' && length < min) {\n throw new LitsError(\n `Wrong number of arguments, expected at least ${min}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n\n if (typeof max === 'number' && length > max) {\n throw new LitsError(\n `Wrong number of arguments, expected at most ${max}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n}\n\nexport function canBeOperator(count: Arity): boolean {\n if (typeof count.max === 'number' && count.max < 2) {\n return false\n }\n\n if (typeof count.min === 'number' && count.min > 2) {\n return false\n }\n\n return true\n}\n\nexport function toFixedArity(arity: number): Arity {\n return { min: arity, max: arity }\n}\n","import type { ContextStack } from '../../../evaluator/ContextStack'\nimport type { ExecuteFunction } from '../../../evaluator/interface'\nimport type { Any, Arr, Coll, Obj } from '../../../interface'\nimport type { SourceCodeInfo } from '../../../tokenizer/token'\nimport { cloneColl, collHasKey, toAny, toNonNegativeInteger } from '../../../utils'\nimport { asColl, assertAny, assertColl, assertFunctionLike, assertObj, isColl, isObj } from '../../../typeGuards/lits'\nimport type { BuiltinNormalExpressions } from '../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber, isNumber } from '../../../typeGuards/number'\nimport { asString, asStringOrNumber, assertString, assertStringOrNumber } from '../../../typeGuards/string'\nimport type { FunctionLike } from '../../../parser/types'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { LitsModule } from '../interface'\n\n// --- Private helper: get value from collection by key ---\nfunction get(coll: Coll, key: string | number): Any | undefined {\n if (isObj(coll)) {\n if (typeof key === 'string' && collHasKey(coll, key))\n return toAny(coll[key])\n }\n else {\n if (isNumber(key, { nonNegative: true, integer: true }) && key >= 0 && key < coll.length)\n return toAny(coll[key])\n }\n return undefined\n}\n\n// --- Private helper: assoc value into collection ---\nfunction assoc(coll: Coll, key: string | number, value: Any, sourceCodeInfo?: SourceCodeInfo) {\n assertColl(coll, sourceCodeInfo)\n if (Array.isArray(coll) || typeof coll === 'string') {\n assertNumber(key, sourceCodeInfo, { integer: true })\n assertNumber(key, sourceCodeInfo, { gte: 0 })\n assertNumber(key, sourceCodeInfo, { lte: coll.length })\n if (typeof coll === 'string') {\n assertString(value, sourceCodeInfo, { char: true })\n return `${coll.slice(0, key)}${value}${coll.slice(key + 1)}`\n }\n const copy = [...coll]\n copy[key] = value\n return copy\n }\n assertString(key, sourceCodeInfo)\n const copy = { ...coll }\n copy[key] = value\n return copy\n}\n\n// --- Private helper: update value in collection ---\nfunction update(\n coll: Coll,\n key: string | number,\n fn: FunctionLike,\n params: Arr,\n contextStack: ContextStack,\n executeFunction: ExecuteFunction,\n sourceCodeInfo?: SourceCodeInfo,\n): Coll {\n if (isObj(coll)) {\n assertString(key, sourceCodeInfo)\n const result = { ...coll }\n result[key] = executeFunction(fn, [result[key], ...params], contextStack, sourceCodeInfo)\n return result\n }\n else {\n assertNumber(key, sourceCodeInfo)\n const intKey = toNonNegativeInteger(key)\n assertNumber(intKey, sourceCodeInfo, { lte: coll.length })\n if (Array.isArray(coll)) {\n const result = coll.map((elem, index) => {\n if (intKey === index)\n return executeFunction(fn, [elem, ...params], contextStack, sourceCodeInfo)\n\n return elem\n })\n if (intKey === coll.length)\n result[intKey] = executeFunction(fn, [undefined, ...params], contextStack, sourceCodeInfo)\n\n return result\n }\n else {\n const result = coll.split('').map((elem, index) => {\n if (intKey === index) {\n return asString(executeFunction(fn, [elem, ...params], contextStack, sourceCodeInfo), sourceCodeInfo, {\n char: true,\n })\n }\n return elem\n })\n if (intKey === coll.length) {\n result[intKey] = asString(\n executeFunction(fn, [undefined, ...params], contextStack, sourceCodeInfo),\n sourceCodeInfo,\n {\n char: true,\n },\n )\n }\n return result.join('')\n }\n }\n}\n\ninterface CollMeta {\n coll: Coll\n parent: Obj | Arr\n}\n\n// --- Private helper: clone and get meta for nested operations ---\nfunction cloneAndGetMeta(\n originalColl: Coll,\n keys: Arr,\n sourceCodeInfo?: SourceCodeInfo,\n): { coll: Coll, innerCollMeta: CollMeta } {\n const coll = cloneColl(originalColl)\n\n const butLastKeys = keys.slice(0, keys.length - 1)\n\n const innerCollMeta = butLastKeys.reduce(\n (result: CollMeta, key) => {\n const resultColl = result.coll\n\n let newResultColl: Coll\n if (Array.isArray(resultColl)) {\n assertNumber(key, sourceCodeInfo)\n newResultColl = asColl(resultColl[key], sourceCodeInfo)\n }\n else {\n assertObj(resultColl, sourceCodeInfo)\n assertString(key, sourceCodeInfo)\n if (!collHasKey(result.coll, key))\n (resultColl)[key] = {}\n\n newResultColl = asColl(resultColl[key], sourceCodeInfo)\n }\n\n return { coll: newResultColl, parent: resultColl }\n },\n { coll, parent: {} },\n )\n return { coll, innerCollMeta }\n}\n\nconst collectionUtilsFunctions: BuiltinNormalExpressions = {\n 'get-in': {\n evaluate: (params, sourceCodeInfo): Any => {\n let coll = toAny(params[0])\n const keys = params[1] ?? [] // null behaves as empty array\n const defaultValue = toAny(params[2])\n assertArray(keys, sourceCodeInfo)\n for (const key of keys) {\n assertStringOrNumber(key, sourceCodeInfo)\n if (isColl(coll)) {\n const nextValue = get(coll, key)\n if (nextValue !== undefined)\n coll = nextValue\n else\n return defaultValue\n }\n else {\n return defaultValue\n }\n }\n return coll\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n 'a': { type: 'collection' },\n 'b': { type: 'array' },\n 'not-found': { type: 'any' },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'not-found'] },\n ],\n description: 'Returns the value in a nested collection, where $b is an array of keys. Returns $not-found if the key is not present. If $not-found is not set, `null` is returned.',\n seeAlso: ['get', 'collection.assoc-in', 'collection.update-in'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.get-in(\n [[1, 2, 3], [4, { a: \"Kalle\" }, 6]],\n [1, 1, \"a\", 0]\n)`,\n `\nlet cu = import(\"collection\");\ncu.get-in(\n [[1, 2, 3], [4, { a: \"Kalle\" }, 6]],\n [1, 1, \"b\", 0]\n)`,\n `\nlet cu = import(\"collection\");\ncu.get-in(\n [[1, 2, 3], [4, { a: \"Kalle\" }, 6]],\n [1, 1, \"b\", 0],\n \"Lisa\"\n)`,\n ],\n },\n },\n 'assoc-in': {\n evaluate: ([originalColl, keys, value], sourceCodeInfo): Coll => {\n assertColl(originalColl, sourceCodeInfo)\n assertArray(keys, sourceCodeInfo)\n assertAny(value, sourceCodeInfo)\n\n if (keys.length === 1) {\n assertStringOrNumber(keys[0], sourceCodeInfo)\n return assoc(originalColl, keys[0], value, sourceCodeInfo)\n }\n\n const { coll, innerCollMeta } = cloneAndGetMeta(originalColl, keys, sourceCodeInfo)\n\n const lastKey = asStringOrNumber(keys[keys.length - 1], sourceCodeInfo)\n const parentKey = asStringOrNumber(keys[keys.length - 2], sourceCodeInfo)\n\n if (Array.isArray(innerCollMeta.parent)) {\n assertNumber(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = assoc(innerCollMeta.coll, lastKey, value, sourceCodeInfo)\n }\n else {\n assertString(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = assoc(innerCollMeta.coll, lastKey, value, sourceCodeInfo)\n }\n\n return coll\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n coll: { type: 'collection' },\n ks: { type: ['number', 'string'], array: true },\n value: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'ks', 'value'] }],\n description: `\nAssociates a value in the nested collection $coll, where $ks is an array of keys and $value is the new value.\n\nIf any levels do not exist, objects will be created - and the corresponding keys must be of type string.`,\n seeAlso: ['assoc', 'collection.get-in', 'collection.update-in'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.assoc-in(\n {},\n [\"a\", \"b\", \"c\"],\n \"Albert\"\n)`,\n `\nlet cu = import(\"collection\");\ncu.assoc-in(\n [1, 2, [1, 2, 3]],\n [2, 1],\n \"Albert\"\n)`,\n `\nlet cu = import(\"collection\");\ncu.assoc-in(\n [1, 2, { name: \"albert\" }],\n [2, \"name\", 0],\n \"A\"\n)`,\n ],\n },\n },\n 'update': {\n evaluate: ([coll, key, fn, ...params], sourceCodeInfo, contextStack, { executeFunction }): Coll => {\n assertColl(coll, sourceCodeInfo)\n assertStringOrNumber(key, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n return update(coll, key, fn, params, contextStack, executeFunction, sourceCodeInfo)\n },\n arity: { min: 3 },\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n 'coll': { type: 'collection' },\n 'key': { type: ['string', 'number'] },\n 'fun': { type: 'function' },\n 'fun-args': { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['coll', 'value', 'fun'] },\n { argumentNames: ['coll', 'value', 'fun', 'fun-args'] },\n ],\n description: `\nUpdates a value in the $coll collection, where $key is a key. $fun is a function\nthat will take the old value and any supplied $fun-args and\nreturn the new value.\nIf the key does not exist, \\`null\\` is passed as the old value.`,\n seeAlso: ['collection.update-in', 'assoc'],\n examples: [\n `\nlet cu = import(\"collection\");\nlet x = { a: 1, b: 2 };\ncu.update(x, \"a\", inc)`,\n `\nlet cu = import(\"collection\");\nlet x = { a: 1, b: 2 };\ncu.update(\n x,\n \"c\",\n val -> null?(val) ? 0 : inc(val)\n)`,\n ],\n },\n },\n 'update-in': {\n evaluate: ([originalColl, keys, fn, ...params], sourceCodeInfo, contextStack, { executeFunction }): Coll => {\n assertColl(originalColl, sourceCodeInfo)\n assertArray(keys, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n if (keys.length === 1) {\n assertStringOrNumber(keys[0], sourceCodeInfo)\n return update(originalColl, keys[0], fn, params, contextStack, executeFunction, sourceCodeInfo)\n }\n\n const { coll, innerCollMeta } = cloneAndGetMeta(originalColl, keys, sourceCodeInfo)\n\n const lastKey = asStringOrNumber(keys[keys.length - 1], sourceCodeInfo)\n const parentKey = asStringOrNumber(keys[keys.length - 2], sourceCodeInfo)\n\n if (Array.isArray(innerCollMeta.parent)) {\n assertNumber(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = update(\n innerCollMeta.coll,\n lastKey,\n fn,\n params,\n contextStack,\n executeFunction,\n sourceCodeInfo,\n )\n }\n else {\n assertString(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = update(\n innerCollMeta.coll,\n lastKey,\n fn,\n params,\n contextStack,\n executeFunction,\n sourceCodeInfo,\n )\n }\n\n return coll\n },\n arity: { min: 3 },\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n 'coll': { type: 'collection' },\n 'ks': { type: 'array' },\n 'fun': { type: 'function' },\n 'fun-args': { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['coll', 'ks', 'fun'] },\n { argumentNames: ['coll', 'ks', 'fun', 'fun-args'] },\n ],\n description: `Updates a value in the $coll collection, where $ks is an array of\nkeys and $fun is a function that will take the old value and\nany supplied $fun-args and return the new value. If any levels do not exist,\nobjects will be created - and the corresponding keys must be of type string.`,\n seeAlso: ['collection.update', 'collection.assoc-in', 'collection.get-in'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.update-in(\n { a: [1, 2, 3] },\n [\"a\", 1],\n -> null?($) ? 0 : inc($)\n)`,\n `\nlet cu = import(\"collection\");\ncu.update-in(\n { a: { foo: \"bar\"} },\n [\"a\", \"foo\"],\n -> null?($) ? \"?\" : \"!\"\n)`,\n `\nlet cu = import(\"collection\");\ncu.update-in(\n { a: { foo: \"bar\"} },\n [\"a\", \"baz\"],\n -> null?($) ? \"?\" : \"!\"\n)`,\n `\nlet cu = import(\"collection\");\ncu.update-in(\n { a: [1, 2, 3] },\n [\"a\", 1],\n *,\n 10,\n 10,\n 10,\n)`,\n ],\n },\n },\n 'filteri': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): Coll => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n if (Array.isArray(coll)) {\n const result = coll.filter((elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n return result\n }\n if (typeof coll === 'string') {\n return coll\n .split('')\n .filter((elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n .join('')\n }\n return Object.entries(coll)\n .filter(([key, value]) => executeFunction(fn, [value, key], contextStack, sourceCodeInfo))\n .reduce((result: Obj, [key, value]) => {\n result[key] = value\n return result\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take two arguments: the element itself and the index.',\n },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Creates a new collection with all elements that pass the test implemented by $b. The function is called for each element in the collection, and it should take two arguments: the element itself and the index.',\n seeAlso: ['filter', 'collection.mapi'],\n examples: [\n 'let cu = import(\"collection\"); cu.filteri([1, 2, 3], (x, i) -> i % 2 == 0)',\n 'let cu = import(\"collection\"); cu.filteri([1, 2, 3], (x, i) -> x % 2 == 0)',\n 'let cu = import(\"collection\"); cu.filteri([1, 2, 3], (x, i) -> x + i > 3)',\n ],\n },\n },\n 'mapi': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }) => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n if (Array.isArray(coll)) {\n return coll.map((elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n }\n if (typeof coll === 'string') {\n return coll\n .split('')\n .map((elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n .join('')\n }\n return Object.entries(coll)\n .reduce((acc: Obj, [key, value]) => {\n acc[key] = executeFunction(fn, [value, key], contextStack, sourceCodeInfo)\n return acc\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take two arguments: the element itself and the index.',\n },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Creates a new collection populated with the results of calling $b on every element in $a. The function is called for each element in the collection, and it should take two arguments: the element itself and the index.',\n seeAlso: ['map', 'collection.filteri'],\n examples: [\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x + i)',\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x * i)',\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x - i)',\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x / i)',\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x % inc(i))',\n ],\n },\n },\n 'reducei': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n assertString(initial, sourceCodeInfo)\n if (coll.length === 0)\n return initial\n\n return coll.split('').reduce((result: Any, elem, index) => {\n return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n }, initial)\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return coll.reduce((result: Any, elem, index) => {\n return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n }, initial)\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return Object.entries(coll).reduce((result: Any, [key, elem]) => {\n return executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo)\n }, initial)\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n coll: { type: 'collection' },\n fun: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take three arguments: the accumulator, the element itself, and the index.',\n },\n initial: {\n type: 'any',\n description: 'The initial value to use as the accumulator.',\n },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value. The function is called for each element in the collection, and it should take three arguments: the accumulator, the element itself, and the index.',\n seeAlso: ['reduce', 'collection.reducei-right', 'collection.reductionsi'],\n examples: [\n 'let cu = import(\"collection\"); cu.reducei([1, 2, 3], (acc, x, i) -> acc + x + i, 0)',\n 'let cu = import(\"collection\"); cu.reducei(\"Albert\", (acc, x, i) -> acc ++ x ++ i, \"\")',\n 'let cu = import(\"collection\"); cu.reducei({ a: 1, b: 2 }, -> $1 ++ $3, \"\")',\n ],\n },\n },\n 'reduce-right': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n if (coll.length === 0)\n return initial\n\n return coll.split('').reduceRight((result: Any, elem) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return coll.reduceRight((result: Any, elem) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return Object.entries(coll).reduceRight((result: Any, [, elem]) => {\n return executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n }, initial)\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n fun: { type: 'function' },\n coll: { type: 'collection' },\n initial: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll (starting from the last item), passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value.',\n seeAlso: ['reduce', 'collection.reducei-right'],\n examples: [\n 'let cu = import(\"collection\"); cu.reduce-right([\"A\", \"B\", \"C\"], str, \"\")',\n 'let cu = import(\"collection\"); cu.reduce-right({ a: 1, b: 2 }, +, 0)',\n ],\n },\n },\n 'reducei-right': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n if (coll.length === 0)\n return initial\n\n return coll.split('').reduceRight((result: Any, elem, index) => {\n return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n }, initial)\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return coll.reduceRight((result: Any, elem, index) => {\n return executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n }, initial)\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return Object.entries(coll).reduceRight((result: Any, [key, elem]) => {\n return executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo)\n }, initial)\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n coll: { type: 'collection' },\n fun: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take three arguments: the accumulator, the element itself, and the index.',\n },\n initial: {\n type: 'any',\n description: 'The initial value to use as the accumulator.',\n },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll (starting from the last item), passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value. The function is called for each element in the collection, and it should take three arguments: the accumulator, the element itself, and the index.',\n seeAlso: ['collection.reducei', 'collection.reduce-right'],\n examples: [\n 'let cu = import(\"collection\"); cu.reducei-right([1, 2, 3], (acc, x, i) -> acc + x + i, 0)',\n 'let cu = import(\"collection\"); cu.reducei-right(\"Albert\", (acc, x, i) -> acc ++ x ++ i, \"\")',\n 'let cu = import(\"collection\"); cu.reducei-right({ a: 1, b: 2 }, -> $1 ++ $3, \"\")',\n ],\n },\n },\n 'reductions': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n assertAny(initial, sourceCodeInfo)\n if (typeof coll === 'string') {\n assertString(initial, sourceCodeInfo)\n if (coll.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n coll.split('').reduce((result: Any, elem) => {\n const newVal = executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n coll.reduce((result: Any, elem) => {\n const newVal = executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n else {\n if (Object.keys(coll).length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n Object.entries(coll).reduce((result: Any, [, elem]) => {\n const newVal = executeFunction(fn, [result, elem], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any', array: true },\n args: {\n fun: { type: 'function' },\n coll: { type: 'collection' },\n initial: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Returns an array of the intermediate values of the reduction (see `reduce`) of $coll by $fun.',\n seeAlso: ['reduce', 'collection.reductionsi'],\n examples: [\n 'let cu = import(\"collection\"); cu.reductions([1, 2, 3], +, 0)',\n 'let cu = import(\"collection\"); cu.reductions([1, 2, 3], +, 10)',\n 'let cu = import(\"collection\"); cu.reductions([], +, 0)',\n 'let cu = import(\"collection\"); cu.reductions({ a: 1, b: 2 }, +, 0)',\n `\nlet cu = import(\"collection\");\ncu.reductions(\n [1, 2, 3, 4, 5, 6, 7, 8, 9],\n (result, value) -> result + (even?(value) ? value : 0),\n 0\n)`,\n ],\n },\n },\n 'reductionsi': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): Any => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n assertAny(initial, sourceCodeInfo)\n if (typeof coll === 'string') {\n assertString(initial, sourceCodeInfo)\n if (coll.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n coll.split('').reduce((result: Any, elem, index) => {\n const newVal = executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n coll.reduce((result: Any, elem, index) => {\n const newVal = executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n else {\n if (Object.keys(coll).length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n Object.entries(coll).reduce((result: Any, [key, elem]) => {\n const newVal = executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo)\n resultArray.push(newVal)\n return newVal\n }, initial)\n return resultArray\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any', array: true },\n args: {\n coll: { type: 'collection' },\n fun: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take three arguments: the accumulator, the element itself, and the index.',\n },\n initial: {\n type: 'any',\n description: 'The initial value to use as the accumulator.',\n },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Returns an array of the intermediate values of the reduction (see `reduce`) of $coll by $fun. The function is called for each element in the collection, and it should take three arguments: the accumulator, the element itself, and the index.',\n seeAlso: ['collection.reductions', 'collection.reducei'],\n examples: [\n 'let cu = import(\"collection\"); cu.reductionsi([1, 2, 3], (acc, x, i) -> acc + x + i, 0)',\n 'let cu = import(\"collection\"); cu.reductionsi(\"Albert\", (acc, x, i) -> acc ++ x ++ i, \"\")',\n 'let cu = import(\"collection\"); cu.reductionsi({ a: 1, b: 2 }, -> $1 ++ $3, \"\")',\n ],\n },\n },\n 'not-empty': {\n evaluate: ([coll], sourceCodeInfo): Coll | null => {\n if (coll === null)\n return null\n\n assertColl(coll, sourceCodeInfo)\n if (typeof coll === 'string')\n return coll.length > 0 ? coll : null\n\n if (Array.isArray(coll))\n return coll.length > 0 ? coll : null\n\n return Object.keys(coll).length > 0 ? coll : null\n },\n arity: toFixedArity(1),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n coll: { type: ['collection', 'null'] },\n },\n variants: [{ argumentNames: ['coll'] }],\n description: 'Returns `null` if $coll is empty or `null`, otherwise $coll.',\n seeAlso: ['empty?', 'not-empty?'],\n examples: [\n 'let cu = import(\"collection\"); cu.not-empty([])',\n 'let cu = import(\"collection\"); cu.not-empty([1, 2, 3])',\n 'let cu = import(\"collection\"); cu.not-empty({})',\n 'let cu = import(\"collection\"); cu.not-empty({ a: 2 })',\n 'let cu = import(\"collection\"); cu.not-empty(\"\")',\n 'let cu = import(\"collection\"); cu.not-empty(\"Albert\")',\n 'let cu = import(\"collection\"); cu.not-empty(null)',\n ],\n },\n },\n 'every?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n if (Array.isArray(coll))\n return coll.every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n if (typeof coll === 'string')\n return coll.split('').every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return Object.entries(coll).every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if all entries in $a pass the test implemented by $b, otherwise returns `false`.',\n seeAlso: ['collection.any?', 'collection.not-every?', 'collection.not-any?', 'functional.every-pred', 'grid.every?'],\n examples: [\n 'let cu = import(\"collection\"); cu.every?([1, 2, 3], number?)',\n 'let cu = import(\"collection\"); cu.every?([1, 2, 3], even?)',\n `\nlet cu = import(\"collection\");\ncu.every?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?,\n)`,\n `\nlet cu = import(\"collection\");\ncu.every?(\n [50, 100, 150, 200],\n -> $ > 10,\n)`,\n 'let cu = import(\"collection\"); cu.every?([], number?)',\n 'let cu = import(\"collection\"); cu.every?(\"\", number?)',\n 'let cu = import(\"collection\"); cu.every?({}, number?)',\n `\nlet cu = import(\"collection\");\ncu.every?(\n { a: 2, b: 4},\n -> even?(second($))\n)`,\n `\nlet cu = import(\"collection\");\ncu.every?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n 'any?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertColl(coll, sourceCodeInfo)\n\n if (Array.isArray(coll))\n return coll.some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n if (typeof coll === 'string')\n return coll.split('').some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return Object.entries(coll).some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if any element in $a pass the test implemented by $b, otherwise returns `false`.',\n seeAlso: ['collection.every?', 'collection.not-any?', 'collection.not-every?', 'functional.some-pred', 'some', 'grid.some?'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.any?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nlet cu = import(\"collection\");\ncu.any?(\n [50, 100, 150, 200],\n x -> x > 10\n)`,\n 'let cu = import(\"collection\"); cu.any?([], number?)',\n 'let cu = import(\"collection\"); cu.any?(\"\", number?)',\n 'let cu = import(\"collection\"); cu.any?({}, number?)',\n `\nlet cu = import(\"collection\");\ncu.any?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n `\nlet cu = import(\"collection\");\ncu.any?(\n { a: 1, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n 'not-any?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertColl(coll, sourceCodeInfo)\n\n if (Array.isArray(coll))\n return !coll.some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n if (typeof coll === 'string')\n return !coll.split('').some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return !Object.entries(coll).some(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `false` if any element in $a pass the test implemented by $b, otherwise returns `true`.',\n seeAlso: ['collection.any?', 'collection.every?', 'collection.not-every?'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.not-any?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nlet cu = import(\"collection\");\ncu.not-any?(\n [50, 100, 150, 200],\n x -> x > 10\n)`,\n 'let cu = import(\"collection\"); cu.not-any?([], number?)',\n 'let cu = import(\"collection\"); cu.not-any?(\"\", number?)',\n 'let cu = import(\"collection\"); cu.not-any?({}, number?)',\n `\nlet cu = import(\"collection\");\ncu.not-any?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n `\nlet cu = import(\"collection\");\ncu.not-any?(\n { a: 1, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n 'not-every?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): boolean => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertColl(coll, sourceCodeInfo)\n\n if (Array.isArray(coll))\n return !coll.every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n if (typeof coll === 'string')\n return !coll.split('').every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n\n return !Object.entries(coll).every(elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if at least one element in $a does not pass the test implemented by $b, otherwise returns `false`.',\n seeAlso: ['collection.every?', 'collection.any?', 'collection.not-any?'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.not-every?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nlet cu = import(\"collection\");\ncu.not-every?(\n [50, 100, 150, 200],\n x -> x > 10\n)`,\n 'let cu = import(\"collection\"); cu.not-every?([], number?)',\n 'let cu = import(\"collection\"); cu.not-every?(\"\", number?)',\n 'let cu = import(\"collection\"); cu.not-every?({}, number?)',\n `\nlet cu = import(\"collection\");\ncu.not-every?(\n { a: 2, b: 4 },\n -> even?(second($))\n)`,\n `\nlet cu = import(\"collection\");\ncu.not-every?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n}\n\nexport const collectionUtilsModule: LitsModule = {\n name: 'collection',\n functions: collectionUtilsFunctions,\n}\n"],"names":["getCodeMarker","sourceCodeInfo","position","code","leftPadding","column","rightPadding","length","repeat","Math","max","LitsError","Error","shortMessage","constructor","err","message","super","location","line","filePath","getLitsErrorMessage","this","Object","setPrototypeOf","prototype","name","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","functionTypeSet","FUNCTION_SYMBOL","REGEXP_SYMBOL","isLitsFunction","func","type","functionType","has","isNode","value","Array","isArray","valueToString","keys","find","key","RegExp","toString","JSON","stringify","getSourceCodeInfo","anyValue","getAssertionError","typeName","assertAny","undefined","isAny","isObj","regexp","isColl","isSeq","asColl","assertColl","assertFunctionLike","isFunctionLike","isNumber","options","isNaN","integer","isInteger","finite","isFinite","zero","nonZero","positive","negative","nonPositive","nonNegative","gt","gte","lt","lte","assertNumber","sign","getSignString","numberType","range","getRangeString","filter","x","join","getNumberTypeName","assertString","nonEmpty","char","isString","asString","asStringOrNumber","assertStringOrNumber","isStringOrNumber","collHasKey","coll","getOwnPropertyDescriptor","toAny","clone","entries","reduce","result","entry","val","map","item","cloneColl","assertArray","toFixedArity","arity","min","get","assoc","slice","copy","update","fn","params","contextStack","executeFunction","intKey","num","ceil","elem","index","split","cloneAndGetMeta","originalColl","innerCollMeta","resultColl","newResultColl","assertObj","parent","collectionUtilsModule","functions","evaluate","defaultValue","nextValue","docs","category","returns","args","a","b","variants","argumentNames","description","seeAlso","examples","lastKey","parentKey","ks","array","fun","rest","filteri","mapi","acc","reducei","initial","reduceRight","reductions","resultArray","newVal","push","reductionsi","every","some"],"mappings":"aAEM,SAAUA,EAAcC,GAC5B,IAAKA,EAAeC,WAAaD,EAAeE,KAC9C,MAAO,GAET,MAAMC,EAAcH,EAAeC,SAASG,OAAS,EAC/CC,EAAeL,EAAeE,KAAKI,OAASH,EAAc,EAChE,MAAO,GAAG,IAAII,OAAOC,KAAKC,IAAIN,EAAa,OAAO,IAAII,OAAOC,KAAKC,IAAIJ,EAAc,KACtF,CCkBM,MAAOK,UAAkBC,MACbX,eACAY,aAChB,WAAAC,CAAYC,EAAcd,GACxB,MAAMe,EAAUD,aAAeH,MAC3BG,EAAIC,QACJ,GAAGD,IAEPE,MA/BJ,SAA6BD,EAAiBf,GAC5C,IAAKA,EACH,OAAOe,EAET,MAAME,EAAW,GAAGjB,EAAeC,SAASiB,QAAQlB,EAAeC,SAASG,SAM5E,MAAO,GAAGW,IALWf,EAAemB,SAChC,KAAKnB,EAAemB,YAAYF,IAChC,cAAcA,QACIjB,EAAeE,SACbH,EAAcC,IAExC,CAoBUoB,CAAoBL,EAASf,IACnCqB,KAAKT,aAAeG,EACpBM,KAAKrB,eAAiBA,EACtBsB,OAAOC,eAAeF,KAAMX,EAAUc,WACtCH,KAAKI,KAAO,WACb,CAEM,aAAA1B,GACL,OAAOsB,KAAKrB,gBAAkBD,EAAcsB,KAAKrB,eAClD,EC5CI,MAAM0B,EAAY,CACvBC,OAAQ,EACRC,OAAQ,EACRC,iBAAkB,EAClBC,kBAAmB,EACnBC,kBAAmB,EACnBC,oBAAqB,EACrBC,qBAAsB,EACtBC,eAAgB,EAChBC,QAAS,EACTC,OAAQ,IAGJC,EAAe,IAAIC,IAAIhB,OAAOiB,OAAOb,IAa3C,MAgBMc,EAAkB,IAAIF,IAhBN,CACpB,cACA,UACA,OACA,aACA,OACA,aACA,YACA,WACA,Q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wE,EAAWuC,EAAM/G,GAEbkD,MAAMC,QAAQ4D,IACRA,EAAKuE,MAAM3C,GAAQJ,EAAgBH,EAAI,CAACO,GAAOL,EAActI,IAEnD,iBAAT+G,GACDA,EAAK8B,MAAM,IAAIyC,MAAM3C,GAAQJ,EAAgBH,EAAI,CAACO,GAAOL,EAActI,KAEzEsB,OAAO6F,QAAQJ,GAAMuE,MAAM3C,GAAQJ,EAAgBH,EAAI,CAACO,GAAOL,EAActI,KAEvF6H,MAAOD,EAAa,GACpB8B,KAAM,CACJC,SAAU,aACVC,QAAS,CAAE/G,KAAM,WACjBgH,KAAM,CACJC,EAAG,CAAEjH,KAAM,cACXkH,EAAG,CAAElH,KAAM,aAEbmH,SAAU,CAAC,CAAEC,cAAe,CAAC,IAAK,OAClCC,YAAa,oHACbC,QAAS,CAAC,oBAAqB,kBAAmB,uBAClDC,SAAU,CACR,sGAMA,6FAMA,4DACA,4DACA,4DACA,gGAMA"}
|
|
1
|
+
{"version":3,"file":"collection.js","sources":["../../src/utils/debug/getCodeMarker.ts","../../src/errors.ts","../../src/constants/constants.ts","../../src/utils/symbols.ts","../../src/utils/debug/debugTools.ts","../../src/utils/debug/getSourceCodeInfo.ts","../../src/utils/getAssertionError.ts","../../src/typeGuards/litsFunction.ts","../../src/typeGuards/lits.ts","../../src/typeGuards/number.ts","../../src/typeGuards/string.ts","../../src/utils/index.ts","../../src/typeGuards/array.ts","../../src/utils/arity.ts","../../src/utils/maybePromise.ts","../../src/builtin/modules/collection/index.ts"],"sourcesContent":["import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getCodeMarker(sourceCodeInfo: SourceCodeInfo): string {\n if (!sourceCodeInfo.position || !sourceCodeInfo.code)\n return ''\n\n const leftPadding = sourceCodeInfo.position.column - 1\n const rightPadding = sourceCodeInfo.code.length - leftPadding - 1\n return `${' '.repeat(Math.max(leftPadding, 0))}^${' '.repeat(Math.max(rightPadding, 0))}`\n}\n","import { getCodeMarker } from '../src/utils/debug/getCodeMarker'\nimport type { Arr } from './interface'\nimport type { SourceCodeInfo } from './tokenizer/token'\n\nfunction getLitsErrorMessage(message: string, sourceCodeInfo?: SourceCodeInfo) {\n if (!sourceCodeInfo) {\n return message\n }\n const location = `${sourceCodeInfo.position.line}:${sourceCodeInfo.position.column}`\n const filePathLine = sourceCodeInfo.filePath\n ? `\\n${sourceCodeInfo.filePath}:${location}`\n : `\\nLocation ${location}`\n const codeLine = `\\n${sourceCodeInfo.code}`\n const codeMarker = `\\n${getCodeMarker(sourceCodeInfo)}`\n return `${message}${filePathLine}${codeLine}${codeMarker}`\n}\n\nexport class RecurSignal extends Error {\n public params: Arr\n constructor(params: Arr) {\n super(`recur, params: ${params}`)\n Object.setPrototypeOf(this, RecurSignal.prototype)\n this.name = 'RecurSignal'\n this.params = params\n }\n}\n\nexport class LitsError extends Error {\n public readonly sourceCodeInfo?: SourceCodeInfo\n public readonly shortMessage: string\n constructor(err: unknown, sourceCodeInfo: SourceCodeInfo | undefined) {\n const message = err instanceof Error\n ? err.message\n : `${err}`\n\n super(getLitsErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, LitsError.prototype)\n this.name = 'LitsError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends LitsError {\n public userMessage: string\n constructor(message: string, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n this.userMessage = message\n Object.setPrototypeOf(this, UserDefinedError.prototype)\n this.name = 'UserDefinedError'\n }\n}\n\nexport class AssertionError extends LitsError {\n constructor(message: string | Error, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n Object.setPrototypeOf(this, AssertionError.prototype)\n this.name = 'AssertionError'\n }\n}\n\nexport class UndefinedSymbolError extends LitsError {\n public symbol: string\n constructor(symbolName: string, sourceCodeInfo?: SourceCodeInfo) {\n const message = `Undefined symbol '${symbolName}'.`\n super(message, sourceCodeInfo)\n this.symbol = symbolName\n Object.setPrototypeOf(this, UndefinedSymbolError.prototype)\n this.name = 'UndefinedSymbolError'\n }\n}\n\nexport function isLitsError(error: unknown): error is LitsError {\n return error instanceof LitsError\n}\n","export const NodeTypes = {\n Number: 1,\n String: 2,\n NormalExpression: 3,\n SpecialExpression: 4,\n UserDefinedSymbol: 5,\n NormalBuiltinSymbol: 6,\n SpecialBuiltinSymbol: 7,\n ReservedSymbol: 8,\n Binding: 9,\n Spread: 10,\n} as const\n\nconst NodeTypesSet = new Set(Object.values(NodeTypes))\n\nexport type NodeType = typeof NodeTypes[keyof typeof NodeTypes]\n\nexport function getNodeTypeName(type: NodeType): keyof typeof NodeTypes {\n return Object.keys(NodeTypes).find(key => NodeTypes[key as keyof typeof NodeTypes] === type) as keyof typeof NodeTypes\n}\n\n// TODO, is this needed?\nexport function isNodeType(type: unknown): type is NodeType {\n return typeof type === 'number' && NodeTypesSet.has(type as NodeType)\n}\n\nconst functionTypes = [\n 'UserDefined',\n 'Partial',\n 'Comp',\n 'Constantly',\n 'Juxt',\n 'Complement',\n 'EveryPred',\n 'SomePred',\n 'Fnull',\n 'Builtin',\n 'SpecialBuiltin',\n 'NativeJsFunction',\n 'Module',\n] as const\n\nconst functionTypeSet = new Set(functionTypes)\n\nexport type FunctionType = typeof functionTypes[number]\n\nexport function isFunctionType(type: unknown): type is FunctionType {\n return typeof type === 'string' && functionTypeSet.has(type as FunctionType)\n}\n","export const FUNCTION_SYMBOL = '^^fn^^'\nexport const REGEXP_SYMBOL = '^^re^^'\n","import { getNodeTypeName, isFunctionType, isNodeType } from '../../constants/constants'\nimport type { AstNode, LitsFunction } from '../../parser/types'\nimport { FUNCTION_SYMBOL } from '../symbols'\n\nfunction isLitsFunction(func: unknown): func is LitsFunction {\n if (func === null || typeof func !== 'object')\n return false\n\n return FUNCTION_SYMBOL in func && 'functionType' in func && isFunctionType(func.functionType)\n}\n\nfunction isNode(value: unknown): value is AstNode {\n if (!Array.isArray(value) || value.length < 2)\n return false\n return isNodeType(value[0])\n}\n\nexport function valueToString(value: unknown): string {\n if (isLitsFunction(value))\n // eslint-disable-next-line ts/no-unsafe-member-access\n return `<function ${(value as any).name || '\\u03BB'}>`\n\n if (isNode(value))\n return `${getNodeTypeName(value[0])}-node`\n\n if (value === null)\n return 'null'\n\n if (typeof value === 'object' && value instanceof RegExp)\n return `${value}`\n\n if (typeof value === 'object' && value instanceof Error)\n return value.toString()\n\n return JSON.stringify(value)\n}\n","import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getSourceCodeInfo(anyValue: any, sourceCodeInfo: SourceCodeInfo | undefined): SourceCodeInfo | undefined {\n // eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access\n return anyValue?.sourceCodeInfo ?? sourceCodeInfo\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from './debug/debugTools'\nimport { getSourceCodeInfo } from './debug/getSourceCodeInfo'\n\nexport function getAssertionError(typeName: string, value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsError {\n return new LitsError(`Expected ${typeName}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo))\n}\n","import type { LitsFunction, NativeJsFunction, NormalBuiltinFunction, UserDefinedFunction } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { FUNCTION_SYMBOL } from '../utils/symbols'\nimport { isUnknownRecord } from '.'\n\nexport function isLitsFunction(value: unknown): value is LitsFunction {\n if (value === null || typeof value !== 'object')\n return false\n\n return !!(value as LitsFunction)[FUNCTION_SYMBOL]\n}\nexport function asLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsFunction {\n assertLitsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is LitsFunction {\n if (!isLitsFunction(value))\n throw getAssertionError('LitsFunction', value, sourceCodeInfo)\n}\n\nexport function isUserDefinedFunction(value: unknown): value is UserDefinedFunction {\n return isLitsFunction(value) && value.functionType === 'UserDefined'\n}\nexport function asUserDefinedFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): UserDefinedFunction {\n assertUserDefinedFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertUserDefinedFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is UserDefinedFunction {\n if (!isUserDefinedFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isNativeJsFunction(value: unknown): value is NativeJsFunction {\n return isLitsFunction(value) && value.functionType === 'NativeJsFunction'\n}\nexport function asNativeJsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): NativeJsFunction {\n assertNativeJsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertNativeJsFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is NativeJsFunction {\n if (!isNativeJsFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isBuiltinFunction(value: unknown): value is NormalBuiltinFunction {\n return isUnknownRecord(value) && value.functionType === 'Builtin'\n}\n","import type { Any, Coll, Obj, Seq } from '../interface'\nimport type { FunctionLike, RegularExpression } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { REGEXP_SYMBOL } from '../utils/symbols'\nimport { isLitsFunction } from './litsFunction'\n\nexport function isAny(value: unknown): value is Any {\n // TODO weak test\n return value !== undefined\n}\nexport function asAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): Any {\n assertAny(value, sourceCodeInfo)\n return value\n}\nexport function assertAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Any {\n if (!isAny(value))\n throw getAssertionError('not undefined', value, sourceCodeInfo)\n}\n\nexport function isSeq(value: unknown): value is Seq {\n return Array.isArray(value) || typeof value === 'string'\n}\nexport function asSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): Seq {\n assertSeq(value, sourceCodeInfo)\n return value\n}\nexport function assertSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Seq {\n if (!isSeq(value))\n throw getAssertionError('string or array', value, sourceCodeInfo)\n}\n\nexport function isObj(value: unknown): value is Obj {\n return !(\n value === null\n || typeof value !== 'object'\n || Array.isArray(value)\n || value instanceof RegExp\n || isLitsFunction(value)\n || isRegularExpression(value)\n )\n}\nexport function asObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): Obj {\n assertObj(value, sourceCodeInfo)\n return value\n}\nexport function assertObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Obj {\n if (!isObj(value))\n throw getAssertionError('object', value, sourceCodeInfo)\n}\n\nexport function isColl(value: unknown): value is Coll {\n return isSeq(value) || isObj(value)\n}\nexport function asColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): Coll {\n assertColl(value, sourceCodeInfo)\n return value\n}\nexport function assertColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Coll {\n if (!isColl(value))\n throw getAssertionError('string, array or object', value, sourceCodeInfo)\n}\n\nexport function isRegularExpression(regexp: unknown): regexp is RegularExpression {\n if (regexp === null || typeof regexp !== 'object')\n return false\n\n return !!(regexp as RegularExpression)[REGEXP_SYMBOL]\n}\nexport function asRegularExpression(value: unknown, sourceCodeInfo?: SourceCodeInfo): RegularExpression {\n assertRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is RegularExpression {\n if (!isRegularExpression(value))\n throw getAssertionError('RegularExpression', value, sourceCodeInfo)\n}\n\nexport function isStringOrRegularExpression(value: unknown): value is string | RegularExpression {\n return isRegularExpression(value) || typeof value === 'string'\n}\nexport function asStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): string | RegularExpression {\n assertStringOrRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | RegularExpression {\n if (!isStringOrRegularExpression(value))\n throw getAssertionError('string or RegularExpression', value, sourceCodeInfo)\n}\n\nfunction isFunctionLike(value: unknown): value is FunctionLike {\n if (typeof value === 'number')\n return true\n if (isColl(value))\n return true\n if (isLitsFunction(value))\n return true\n\n return false\n}\nexport function asFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): FunctionLike {\n assertFunctionLike(value, sourceCodeInfo)\n return value\n}\nexport function assertFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is FunctionLike {\n if (!isFunctionLike(value))\n throw getAssertionError('FunctionLike', value, sourceCodeInfo)\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\ntype SignOptions =\n | {\n positive?: true\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: true\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: true\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: true\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: true\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: true\n }\n\ntype GtOptions =\n | {\n gt?: number\n gte?: never\n }\n | {\n gt?: never\n gte?: number\n }\n\ntype LtOptions =\n | {\n lt?: number\n lte?: never\n }\n | {\n lt?: never\n lte?: number\n }\n\ntype NumberOptions = {\n integer?: true\n finite?: true\n} & SignOptions &\nGtOptions &\nLtOptions\n\nfunction getRangeString(options: NumberOptions): string {\n const hasUpperAndLowerBound\n = (typeof options.gt === 'number' || typeof options.gte === 'number')\n && (typeof options.lt === 'number' || typeof options.lte === 'number')\n if (hasUpperAndLowerBound) {\n return `${typeof options.gt === 'number' ? `${options.gt} < n ` : `${options.gte} <= n `}${\n typeof options.lt === 'number' ? `< ${options.lt}` : `<= ${options.lte}`\n }`\n }\n else if (typeof options.gt === 'number' || typeof options.gte === 'number') {\n return `${typeof options.gt === 'number' ? `n > ${options.gt}` : `n >= ${options.gte}`}`\n }\n else if (typeof options.lt === 'number' || typeof options.lte === 'number') {\n return `${typeof options.lt === 'number' ? `n < ${options.lt}` : `n <= ${options.lte}`}`\n }\n else { return '' }\n}\n\nfunction getSignString(options: NumberOptions): string {\n return options.positive\n ? 'positive'\n : options.negative\n ? 'negative'\n : options.nonNegative\n ? 'non negative'\n : options.nonPositive\n ? 'non positive'\n : options.nonZero\n ? 'non zero'\n : ''\n}\n\nfunction getNumberTypeName(options: NumberOptions): string {\n if (options.zero)\n return 'zero'\n\n const sign = getSignString(options)\n const numberType = options.integer ? 'integer' : 'number'\n const finite = options.finite ? 'finite' : ''\n const range = getRangeString(options)\n\n return [sign, finite, numberType, range].filter(x => !!x).join(' ')\n}\n\nexport function isNumber(value: unknown, options: NumberOptions = {}): value is number {\n if (typeof value !== 'number')\n return false\n\n if (Number.isNaN(value))\n return false\n\n if (options.integer && !Number.isInteger(value))\n return false\n\n if (options.finite && !Number.isFinite(value))\n return false\n\n if (options.zero && value !== 0)\n return false\n\n if (options.nonZero && value === 0)\n return false\n\n if (options.positive && value <= 0)\n return false\n\n if (options.negative && value >= 0)\n return false\n\n if (options.nonPositive && value > 0)\n return false\n\n if (options.nonNegative && value < 0)\n return false\n\n if (typeof options.gt === 'number' && value <= options.gt)\n return false\n\n if (typeof options.gte === 'number' && value < options.gte)\n return false\n\n if (typeof options.lt === 'number' && value >= options.lt)\n return false\n\n if (typeof options.lte === 'number' && value > options.lte)\n return false\n\n return true\n}\n\nexport function assertNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n options: NumberOptions = {},\n): asserts value is number {\n if (!isNumber(value, options)) {\n throw new LitsError(\n `Expected ${getNumberTypeName(options)}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asNumber(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: NumberOptions = {},\n): number {\n assertNumber(value, sourceCodeInfo, options)\n return value\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\ntype StringAssertionOptions =\n | {\n nonEmpty?: true\n char?: never\n }\n | {\n nonEmpty?: never\n char?: true\n }\n\nexport function isString(value: unknown, options: StringAssertionOptions = {}): value is string {\n if (typeof value !== 'string')\n return false\n\n if (options.nonEmpty && value.length === 0)\n return false\n\n if (options.char && value.length !== 1)\n return false\n\n return true\n}\n\nexport function assertString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): asserts value is string {\n if (!isString(value, options)) {\n throw getAssertionError(\n `${options.nonEmpty ? 'non empty string' : options.char ? 'character' : 'string'}`,\n value,\n sourceCodeInfo,\n )\n }\n}\n\nexport function asString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): string {\n assertString(value, sourceCodeInfo, options)\n return value\n}\n\nexport function isStringOrNumber(value: unknown): value is string | number {\n return typeof value === 'string' || typeof value === 'number'\n}\nexport function asStringOrNumber(value: unknown, sourceCodeInfo?: SourceCodeInfo): string | number {\n assertStringOrNumber(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | number {\n if (!isStringOrNumber(value))\n throw getAssertionError('string or number', value, sourceCodeInfo)\n}\n","import type { Any, Coll, Obj } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { asAny, isColl, isObj, isRegularExpression } from '../typeGuards/lits'\nimport { isNumber } from '../typeGuards/number'\nimport { asString, assertStringOrNumber } from '../typeGuards/string'\nimport { isUnknownRecord } from '../typeGuards'\nimport { LitsError } from '../errors'\n\nexport function collHasKey(coll: unknown, key: string | number): boolean {\n if (!isColl(coll))\n return false\n\n if (typeof coll === 'string' || Array.isArray(coll)) {\n if (!isNumber(key, { integer: true }))\n return false\n\n return key >= 0 && key < coll.length\n }\n return !!Object.getOwnPropertyDescriptor(coll, key)\n}\n\nexport function compare<T extends string | number>(a: T, b: T, sourceCodeInfo: SourceCodeInfo | undefined): number {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n\n if (typeof a === 'string' && typeof b === 'string') {\n return a < b ? -1 : a > b ? 1 : 0\n }\n if (typeof a === 'number' && typeof b === 'number') {\n return Math.sign((a) - (b))\n }\n throw new LitsError(`Cannot compare values of different types: ${typeof a} and ${typeof b}`, sourceCodeInfo)\n}\n\nexport function deepEqual(a: unknown, b: unknown, sourceCodeInfo?: SourceCodeInfo): boolean {\n if (a === b)\n return true\n\n if (typeof a === 'number' && typeof b === 'number')\n return approxEqual(a, b)\n\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length)\n return false\n\n for (let i = 0; i < a.length; i += 1) {\n if (!deepEqual(asAny(a[i], sourceCodeInfo), asAny(b[i], sourceCodeInfo), sourceCodeInfo))\n return false\n }\n return true\n }\n if (isRegularExpression(a) && isRegularExpression(b))\n return a.s === b.s && a.f === b.f\n\n if (isUnknownRecord(a) && isUnknownRecord(b)) {\n const aKeys = Object.keys(a)\n const bKeys = Object.keys(b)\n if (aKeys.length !== bKeys.length)\n return false\n\n for (let i = 0; i < aKeys.length; i += 1) {\n const key = asString(aKeys[i], sourceCodeInfo)\n if (!deepEqual(a[key], b[key], sourceCodeInfo))\n return false\n }\n return true\n }\n return false\n}\n\nexport function toNonNegativeInteger(num: number): number {\n return Math.max(0, Math.ceil(num))\n}\n\nexport function toAny(value: unknown): Any {\n return (value ?? null) as Any\n}\n\nfunction clone<T>(value: T): T {\n if (isObj(value)) {\n return Object.entries(value).reduce((result: Obj, entry) => {\n const [key, val] = entry\n result[key] = clone(val)\n return result\n }, {}) as T\n }\n if (Array.isArray(value))\n // eslint-disable-next-line ts/no-unsafe-return\n return value.map(item => clone(item)) as unknown as T\n\n return value\n}\n\nexport function cloneColl<T extends Coll>(value: T): T {\n return clone(value)\n}\n\nexport function joinSets<T>(...results: Set<T>[]): Set<T> {\n const result = new Set<T>()\n for (const symbols of results)\n symbols.forEach(symbol => result.add(symbol))\n\n return result\n}\n\nexport function addToSet<T>(target: Set<T>, source: Set<T>): void {\n source.forEach(symbol => target.add(symbol))\n}\n\nexport const EPSILON = 1e-10\n\nexport function approxEqual(a: number, b: number, epsilon: number = EPSILON): boolean {\n if (a === b) {\n return true\n }\n\n const diff = Math.abs(a - b)\n\n if (a === 0 || b === 0 || diff < epsilon) {\n // Use absolute error for values near zero\n return diff < epsilon\n }\n const absA = Math.abs(a)\n const absB = Math.abs(b)\n\n // Use relative error for larger values\n return diff / (absA + absB) < epsilon\n}\n\nexport function approxZero(value: number): boolean {\n return Math.abs(value) < EPSILON\n}\n\nexport function smartTrim(str: string, minIndent = 0): string {\n const lines = str.split('\\n')\n while (lines[0]?.match(/^\\s*$/)) {\n lines.shift() // Remove leading empty lines\n }\n while (lines[lines.length - 1]?.match(/^\\s*$/)) {\n lines.pop() // Remove trailing empty lines\n }\n const indent = lines.reduce((acc, line) => {\n if (line.match(/^\\s*$/))\n return acc // Skip empty lines\n const lineIndent = line.match(/^\\s*/)![0].length\n return Math.min(acc, lineIndent)\n }, Infinity)\n return lines.map(line => ' '.repeat(minIndent) + line.slice(indent)).join('\\n').trimEnd()\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\n// isArray not needed, use Array.isArary\nexport function asArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): unknown[] {\n assertArray(value, sourceCodeInfo)\n return value\n}\nexport function assertArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is unknown[] {\n if (!Array.isArray(value))\n throw getAssertionError('array', value, sourceCodeInfo)\n}\n\nexport function isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string')\n}\nexport function asStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertStringArray(value, sourceCodeInfo)\n return value\n}\nexport function assertStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isStringArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n\nexport function isCharArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string' && v.length === 1)\n}\nexport function asCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertCharArray(value, sourceCodeInfo)\n return value\n}\nexport function assertCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isCharArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n","import type { Arity } from '../builtin/interface'\nimport { LitsError } from '../errors'\nimport type { FunctionLike } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isColl } from '../typeGuards/lits'\nimport { valueToString } from './debug/debugTools'\n\nexport function arityAccepts(arity: Arity, nbrOfParams: number): boolean {\n const { min, max } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n if (typeof max === 'number' && nbrOfParams > max) {\n return false\n }\n return true\n}\n\nexport function arityAcceptsMin(arity: Arity, nbrOfParams: number): boolean {\n const { min } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n return true\n}\n\nexport function getCommonArityFromFunctions(params: FunctionLike[]): Arity | null {\n return params.reduce((acc: Arity | null, param): Arity | null => {\n if (acc === null) {\n return null\n }\n const arity: Arity = (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n const { min: aMin, max: aMax } = arity\n const { min: bMin, max: bMax } = acc\n const min = typeof aMin === 'number' && typeof bMin === 'number'\n ? Math.max(aMin, bMin)\n : typeof aMin === 'number' ? aMin : typeof bMin === 'number' ? bMin : undefined\n const max = typeof aMax === 'number' && typeof bMax === 'number'\n ? Math.min(aMax, bMax)\n : typeof aMax === 'number' ? aMax : typeof bMax === 'number' ? bMax : undefined\n\n if (typeof min === 'number' && typeof max === 'number' && min > max) {\n return null\n }\n\n return { min, max }\n }, {})\n}\n\nexport function getArityFromFunction(param: FunctionLike): Arity {\n return (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n}\n\nexport function assertNumberOfParams(arity: Arity, length: number, sourceCodeInfo: SourceCodeInfo | undefined): void {\n const { min, max } = arity\n if (typeof min === 'number' && length < min) {\n throw new LitsError(\n `Wrong number of arguments, expected at least ${min}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n\n if (typeof max === 'number' && length > max) {\n throw new LitsError(\n `Wrong number of arguments, expected at most ${max}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n}\n\nexport function canBeOperator(count: Arity): boolean {\n if (typeof count.max === 'number' && count.max < 2) {\n return false\n }\n\n if (typeof count.min === 'number' && count.min > 2) {\n return false\n }\n\n return true\n}\n\nexport function toFixedArity(arity: number): Arity {\n return { min: arity, max: arity }\n}\n","/**\n * MaybePromise utilities for transparent async support.\n *\n * The sync path stays zero-overhead — when no async JS functions are involved,\n * everything runs synchronously with only `instanceof Promise` checks as overhead.\n * When an async value is detected, the evaluation chain switches to Promise-based\n * execution for the remainder.\n */\n\nexport type MaybePromise<T> = T | Promise<T>\n\n/**\n * Chain a value that might be a Promise. If the value is sync, calls fn synchronously.\n * If it's a Promise, chains with .then().\n */\nexport function chain<T, U>(value: MaybePromise<T>, fn: (v: T) => MaybePromise<U>): MaybePromise<U> {\n if (value instanceof Promise) {\n return value.then(fn)\n }\n return fn(value)\n}\n\n/**\n * Like Array.map but handles MaybePromise callbacks sequentially.\n * In the sync case, runs as a simple loop. Switches to async only when needed.\n */\nexport function mapSequential<T, U>(\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<U>,\n): MaybePromise<U[]> {\n const results: U[] = []\n for (let i = 0; i < arr.length; i++) {\n const result = fn(arr[i]!, i)\n if (result instanceof Promise) {\n return chainRemainingMap(result, results, arr, fn, i)\n }\n results.push(result)\n }\n return results\n}\n\nasync function chainRemainingMap<T, U>(\n currentPromise: Promise<U>,\n results: U[],\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<U>,\n startIndex: number,\n): Promise<U[]> {\n results.push(await currentPromise)\n for (let i = startIndex + 1; i < arr.length; i++) {\n results.push(await fn(arr[i]!, i))\n }\n return results\n}\n\n/**\n * Like Array.reduce but handles MaybePromise callbacks sequentially.\n * In the sync case, runs as a simple loop. Switches to async only when needed.\n */\nexport function reduceSequential<T, U>(\n arr: readonly T[],\n fn: (acc: U, elem: T, index: number) => MaybePromise<U>,\n initial: U,\n): MaybePromise<U> {\n let result: U = initial\n for (let i = 0; i < arr.length; i++) {\n const next = fn(result, arr[i]!, i)\n if (next instanceof Promise) {\n return chainRemainingReduce(next, arr, fn, i)\n }\n result = next\n }\n return result\n}\n\nasync function chainRemainingReduce<T, U>(\n currentPromise: Promise<U>,\n arr: readonly T[],\n fn: (acc: U, elem: T, index: number) => MaybePromise<U>,\n startIndex: number,\n): Promise<U> {\n let result = await currentPromise\n for (let i = startIndex + 1; i < arr.length; i++) {\n result = await fn(result, arr[i]!, i)\n }\n return result\n}\n\n/**\n * Like Array.forEach but handles MaybePromise callbacks sequentially.\n * In the sync case, runs as a simple loop. Switches to async only when needed.\n */\nexport function forEachSequential<T>(\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<void>,\n): MaybePromise<void> {\n for (let i = 0; i < arr.length; i++) {\n const result = fn(arr[i]!, i)\n if (result instanceof Promise) {\n return chainRemainingForEach(result, arr, fn, i)\n }\n }\n}\n\nasync function chainRemainingForEach<T>(\n currentPromise: Promise<void>,\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<void>,\n startIndex: number,\n): Promise<void> {\n await currentPromise\n for (let i = startIndex + 1; i < arr.length; i++) {\n await fn(arr[i]!, i)\n }\n}\n\n/**\n * Try/catch that handles MaybePromise values correctly.\n * If tryFn returns a Promise, catches both sync throws and Promise rejections.\n */\nexport function tryCatch<T>(\n tryFn: () => MaybePromise<T>,\n catchFn: (error: unknown) => MaybePromise<T>,\n): MaybePromise<T> {\n try {\n const result = tryFn()\n if (result instanceof Promise) {\n return result.catch(catchFn)\n }\n return result\n }\n catch (error) {\n return catchFn(error)\n }\n}\n\n/**\n * Like Array.some but handles MaybePromise callbacks sequentially.\n * Returns the first truthy MaybePromise result, or false.\n */\nexport function someSequential<T>(\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n): MaybePromise<boolean> {\n for (let i = 0; i < arr.length; i++) {\n const result = fn(arr[i]!, i)\n if (result instanceof Promise) {\n return chainRemainingSome(result, arr, fn, i)\n }\n if (result)\n return true\n }\n return false\n}\n\nasync function chainRemainingSome<T>(\n currentPromise: Promise<unknown>,\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n startIndex: number,\n): Promise<boolean> {\n if (await currentPromise)\n return true\n for (let i = startIndex + 1; i < arr.length; i++) {\n if (await fn(arr[i]!, i))\n return true\n }\n return false\n}\n\n/**\n * Like Array.every but handles MaybePromise callbacks sequentially.\n * Returns false as soon as a falsy result is found.\n */\nexport function everySequential<T>(\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n): MaybePromise<boolean> {\n for (let i = 0; i < arr.length; i++) {\n const result = fn(arr[i]!, i)\n if (result instanceof Promise) {\n return chainRemainingEvery(result, arr, fn, i)\n }\n if (!result)\n return false\n }\n return true\n}\n\nasync function chainRemainingEvery<T>(\n currentPromise: Promise<unknown>,\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n startIndex: number,\n): Promise<boolean> {\n if (!await currentPromise)\n return false\n for (let i = startIndex + 1; i < arr.length; i++) {\n if (!await fn(arr[i]!, i))\n return false\n }\n return true\n}\n\n/**\n * Like Array.filter but handles MaybePromise callbacks sequentially.\n * Returns the filtered array.\n */\nexport function filterSequential<T>(\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n): MaybePromise<T[]> {\n const results: T[] = []\n for (let i = 0; i < arr.length; i++) {\n const result = fn(arr[i]!, i)\n if (result instanceof Promise) {\n return chainRemainingFilter(result, results, arr, fn, i)\n }\n if (result)\n results.push(arr[i]!)\n }\n return results\n}\n\nasync function chainRemainingFilter<T>(\n currentPromise: Promise<unknown>,\n results: T[],\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n startIndex: number,\n): Promise<T[]> {\n if (await currentPromise)\n results.push(arr[startIndex]!)\n for (let i = startIndex + 1; i < arr.length; i++) {\n if (await fn(arr[i]!, i))\n results.push(arr[i]!)\n }\n return results\n}\n\n/**\n * Like Array.findIndex but handles MaybePromise callbacks sequentially.\n * Returns -1 if no element matches.\n */\nexport function findIndexSequential<T>(\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n): MaybePromise<number> {\n for (let i = 0; i < arr.length; i++) {\n const result = fn(arr[i]!, i)\n if (result instanceof Promise) {\n return chainRemainingFindIndex(result, arr, fn, i)\n }\n if (result)\n return i\n }\n return -1\n}\n\nasync function chainRemainingFindIndex<T>(\n currentPromise: Promise<unknown>,\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n startIndex: number,\n): Promise<number> {\n if (await currentPromise)\n return startIndex\n for (let i = startIndex + 1; i < arr.length; i++) {\n if (await fn(arr[i]!, i))\n return i\n }\n return -1\n}\n","import type { ContextStack } from '../../../evaluator/ContextStack'\nimport type { ExecuteFunction } from '../../../evaluator/interface'\nimport type { Any, Arr, Coll, Obj } from '../../../interface'\nimport type { SourceCodeInfo } from '../../../tokenizer/token'\nimport { cloneColl, collHasKey, toAny, toNonNegativeInteger } from '../../../utils'\nimport { asColl, assertAny, assertColl, assertFunctionLike, assertObj, isColl, isObj } from '../../../typeGuards/lits'\nimport type { BuiltinNormalExpressions } from '../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber, isNumber } from '../../../typeGuards/number'\nimport { asString, asStringOrNumber, assertString, assertStringOrNumber } from '../../../typeGuards/string'\nimport type { FunctionLike } from '../../../parser/types'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { MaybePromise } from '../../../utils/maybePromise'\nimport { chain, everySequential, filterSequential, mapSequential, reduceSequential, someSequential } from '../../../utils/maybePromise'\nimport type { LitsModule } from '../interface'\n\n// --- Private helper: get value from collection by key ---\nfunction get(coll: Coll, key: string | number): Any | undefined {\n if (isObj(coll)) {\n if (typeof key === 'string' && collHasKey(coll, key))\n return toAny(coll[key])\n }\n else {\n if (isNumber(key, { nonNegative: true, integer: true }) && key >= 0 && key < coll.length)\n return toAny(coll[key])\n }\n return undefined\n}\n\n// --- Private helper: assoc value into collection ---\nfunction assoc(coll: Coll, key: string | number, value: Any, sourceCodeInfo?: SourceCodeInfo) {\n assertColl(coll, sourceCodeInfo)\n if (Array.isArray(coll) || typeof coll === 'string') {\n assertNumber(key, sourceCodeInfo, { integer: true })\n assertNumber(key, sourceCodeInfo, { gte: 0 })\n assertNumber(key, sourceCodeInfo, { lte: coll.length })\n if (typeof coll === 'string') {\n assertString(value, sourceCodeInfo, { char: true })\n return `${coll.slice(0, key)}${value}${coll.slice(key + 1)}`\n }\n const copy = [...coll]\n copy[key] = value\n return copy\n }\n assertString(key, sourceCodeInfo)\n const copy = { ...coll }\n copy[key] = value\n return copy\n}\n\n// --- Private helper: update value in collection ---\nfunction update(\n coll: Coll,\n key: string | number,\n fn: FunctionLike,\n params: Arr,\n contextStack: ContextStack,\n executeFunction: ExecuteFunction,\n sourceCodeInfo?: SourceCodeInfo,\n): MaybePromise<Coll> {\n if (isObj(coll)) {\n assertString(key, sourceCodeInfo)\n const result = { ...coll }\n return chain(executeFunction(fn, [result[key], ...params], contextStack, sourceCodeInfo), (val) => {\n result[key] = val\n return result\n })\n }\n else {\n assertNumber(key, sourceCodeInfo)\n const intKey = toNonNegativeInteger(key)\n assertNumber(intKey, sourceCodeInfo, { lte: coll.length })\n if (Array.isArray(coll)) {\n return chain(\n mapSequential(Array.from({ length: coll.length + (intKey === coll.length ? 1 : 0) }), (_, index) => {\n if (intKey === index)\n return executeFunction(fn, [coll[index], ...params], contextStack, sourceCodeInfo)\n return coll[index] as Any\n }),\n result => result,\n )\n }\n else {\n const chars = coll.split('')\n return chain(\n mapSequential(Array.from({ length: chars.length + (intKey === chars.length ? 1 : 0) }), (_, index) => {\n if (intKey === index) {\n return chain(\n executeFunction(fn, [chars[index], ...params], contextStack, sourceCodeInfo),\n val => asString(val, sourceCodeInfo, { char: true }),\n )\n }\n return chars[index] as string\n }),\n result => result.join(''),\n )\n }\n }\n}\n\ninterface CollMeta {\n coll: Coll\n parent: Obj | Arr\n}\n\n// --- Private helper: clone and get meta for nested operations ---\nfunction cloneAndGetMeta(\n originalColl: Coll,\n keys: Arr,\n sourceCodeInfo?: SourceCodeInfo,\n): { coll: Coll, innerCollMeta: CollMeta } {\n const coll = cloneColl(originalColl)\n\n const butLastKeys = keys.slice(0, keys.length - 1)\n\n const innerCollMeta = butLastKeys.reduce(\n (result: CollMeta, key) => {\n const resultColl = result.coll\n\n let newResultColl: Coll\n if (Array.isArray(resultColl)) {\n assertNumber(key, sourceCodeInfo)\n newResultColl = asColl(resultColl[key], sourceCodeInfo)\n }\n else {\n assertObj(resultColl, sourceCodeInfo)\n assertString(key, sourceCodeInfo)\n if (!collHasKey(result.coll, key))\n (resultColl)[key] = {}\n\n newResultColl = asColl(resultColl[key], sourceCodeInfo)\n }\n\n return { coll: newResultColl, parent: resultColl }\n },\n { coll, parent: {} },\n )\n return { coll, innerCollMeta }\n}\n\nconst collectionUtilsFunctions: BuiltinNormalExpressions = {\n 'get-in': {\n evaluate: (params, sourceCodeInfo): Any => {\n let coll = toAny(params[0])\n const keys = params[1] ?? [] // null behaves as empty array\n const defaultValue = toAny(params[2])\n assertArray(keys, sourceCodeInfo)\n for (const key of keys) {\n assertStringOrNumber(key, sourceCodeInfo)\n if (isColl(coll)) {\n const nextValue = get(coll, key)\n if (nextValue !== undefined)\n coll = nextValue\n else\n return defaultValue\n }\n else {\n return defaultValue\n }\n }\n return coll\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n 'a': { type: 'collection' },\n 'b': { type: 'array' },\n 'not-found': { type: 'any' },\n },\n variants: [\n { argumentNames: ['a', 'b'] },\n { argumentNames: ['a', 'b', 'not-found'] },\n ],\n description: 'Returns the value in a nested collection, where $b is an array of keys. Returns $not-found if the key is not present. If $not-found is not set, `null` is returned.',\n seeAlso: ['get', 'collection.assoc-in', 'collection.update-in'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.get-in(\n [[1, 2, 3], [4, { a: \"Kalle\" }, 6]],\n [1, 1, \"a\", 0]\n)`,\n `\nlet cu = import(\"collection\");\ncu.get-in(\n [[1, 2, 3], [4, { a: \"Kalle\" }, 6]],\n [1, 1, \"b\", 0]\n)`,\n `\nlet cu = import(\"collection\");\ncu.get-in(\n [[1, 2, 3], [4, { a: \"Kalle\" }, 6]],\n [1, 1, \"b\", 0],\n \"Lisa\"\n)`,\n ],\n },\n },\n 'assoc-in': {\n evaluate: ([originalColl, keys, value], sourceCodeInfo): Coll => {\n assertColl(originalColl, sourceCodeInfo)\n assertArray(keys, sourceCodeInfo)\n assertAny(value, sourceCodeInfo)\n\n if (keys.length === 1) {\n assertStringOrNumber(keys[0], sourceCodeInfo)\n return assoc(originalColl, keys[0], value, sourceCodeInfo)\n }\n\n const { coll, innerCollMeta } = cloneAndGetMeta(originalColl, keys, sourceCodeInfo)\n\n const lastKey = asStringOrNumber(keys[keys.length - 1], sourceCodeInfo)\n const parentKey = asStringOrNumber(keys[keys.length - 2], sourceCodeInfo)\n\n if (Array.isArray(innerCollMeta.parent)) {\n assertNumber(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = assoc(innerCollMeta.coll, lastKey, value, sourceCodeInfo)\n }\n else {\n assertString(parentKey, sourceCodeInfo)\n innerCollMeta.parent[parentKey] = assoc(innerCollMeta.coll, lastKey, value, sourceCodeInfo)\n }\n\n return coll\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n coll: { type: 'collection' },\n ks: { type: ['number', 'string'], array: true },\n value: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'ks', 'value'] }],\n description: `\nAssociates a value in the nested collection $coll, where $ks is an array of keys and $value is the new value.\n\nIf any levels do not exist, objects will be created - and the corresponding keys must be of type string.`,\n seeAlso: ['assoc', 'collection.get-in', 'collection.update-in'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.assoc-in(\n {},\n [\"a\", \"b\", \"c\"],\n \"Albert\"\n)`,\n `\nlet cu = import(\"collection\");\ncu.assoc-in(\n [1, 2, [1, 2, 3]],\n [2, 1],\n \"Albert\"\n)`,\n `\nlet cu = import(\"collection\");\ncu.assoc-in(\n [1, 2, { name: \"albert\" }],\n [2, \"name\", 0],\n \"A\"\n)`,\n ],\n },\n },\n 'update': {\n evaluate: ([coll, key, fn, ...params], sourceCodeInfo, contextStack, { executeFunction }): MaybePromise<Coll> => {\n assertColl(coll, sourceCodeInfo)\n assertStringOrNumber(key, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n return update(coll, key, fn, params, contextStack, executeFunction, sourceCodeInfo)\n },\n arity: { min: 3 },\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n 'coll': { type: 'collection' },\n 'key': { type: ['string', 'number'] },\n 'fun': { type: 'function' },\n 'fun-args': { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['coll', 'value', 'fun'] },\n { argumentNames: ['coll', 'value', 'fun', 'fun-args'] },\n ],\n description: `\nUpdates a value in the $coll collection, where $key is a key. $fun is a function\nthat will take the old value and any supplied $fun-args and\nreturn the new value.\nIf the key does not exist, \\`null\\` is passed as the old value.`,\n seeAlso: ['collection.update-in', 'assoc'],\n examples: [\n `\nlet cu = import(\"collection\");\nlet x = { a: 1, b: 2 };\ncu.update(x, \"a\", inc)`,\n `\nlet cu = import(\"collection\");\nlet x = { a: 1, b: 2 };\ncu.update(\n x,\n \"c\",\n val -> null?(val) ? 0 : inc(val)\n)`,\n ],\n },\n },\n 'update-in': {\n evaluate: ([originalColl, keys, fn, ...params], sourceCodeInfo, contextStack, { executeFunction }): MaybePromise<Coll> => {\n assertColl(originalColl, sourceCodeInfo)\n assertArray(keys, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n if (keys.length === 1) {\n assertStringOrNumber(keys[0], sourceCodeInfo)\n return update(originalColl, keys[0], fn, params, contextStack, executeFunction, sourceCodeInfo)\n }\n\n const { coll, innerCollMeta } = cloneAndGetMeta(originalColl, keys, sourceCodeInfo)\n\n const lastKey = asStringOrNumber(keys[keys.length - 1], sourceCodeInfo)\n const parentKey = asStringOrNumber(keys[keys.length - 2], sourceCodeInfo)\n\n if (Array.isArray(innerCollMeta.parent)) {\n assertNumber(parentKey, sourceCodeInfo)\n return chain(\n update(innerCollMeta.coll, lastKey, fn, params, contextStack, executeFunction, sourceCodeInfo),\n (updated) => {\n ;(innerCollMeta.parent as Any[])[parentKey] = updated\n return coll\n },\n )\n }\n else {\n assertString(parentKey, sourceCodeInfo)\n return chain(\n update(innerCollMeta.coll, lastKey, fn, params, contextStack, executeFunction, sourceCodeInfo),\n (updated) => {\n ;(innerCollMeta.parent as Record<string, unknown>)[parentKey] = updated\n return coll\n },\n )\n }\n },\n arity: { min: 3 },\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n 'coll': { type: 'collection' },\n 'ks': { type: 'array' },\n 'fun': { type: 'function' },\n 'fun-args': { type: 'any', rest: true },\n },\n variants: [\n { argumentNames: ['coll', 'ks', 'fun'] },\n { argumentNames: ['coll', 'ks', 'fun', 'fun-args'] },\n ],\n description: `Updates a value in the $coll collection, where $ks is an array of\nkeys and $fun is a function that will take the old value and\nany supplied $fun-args and return the new value. If any levels do not exist,\nobjects will be created - and the corresponding keys must be of type string.`,\n seeAlso: ['collection.update', 'collection.assoc-in', 'collection.get-in'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.update-in(\n { a: [1, 2, 3] },\n [\"a\", 1],\n -> null?($) ? 0 : inc($)\n)`,\n `\nlet cu = import(\"collection\");\ncu.update-in(\n { a: { foo: \"bar\"} },\n [\"a\", \"foo\"],\n -> null?($) ? \"?\" : \"!\"\n)`,\n `\nlet cu = import(\"collection\");\ncu.update-in(\n { a: { foo: \"bar\"} },\n [\"a\", \"baz\"],\n -> null?($) ? \"?\" : \"!\"\n)`,\n `\nlet cu = import(\"collection\");\ncu.update-in(\n { a: [1, 2, 3] },\n [\"a\", 1],\n *,\n 10,\n 10,\n 10,\n)`,\n ],\n },\n },\n 'filteri': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): MaybePromise<Coll> => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n if (Array.isArray(coll)) {\n return filterSequential(coll, (elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n }\n if (typeof coll === 'string') {\n return chain(\n filterSequential(coll.split(''), (elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo)),\n filtered => filtered.join(''),\n )\n }\n return chain(\n filterSequential(Object.entries(coll), ([key, value]) => executeFunction(fn, [value, key], contextStack, sourceCodeInfo)),\n filtered => filtered.reduce((result: Obj, [key, value]) => {\n result[key] = value\n return result\n }, {}),\n )\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take two arguments: the element itself and the index.',\n },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Creates a new collection with all elements that pass the test implemented by $b. The function is called for each element in the collection, and it should take two arguments: the element itself and the index.',\n seeAlso: ['filter', 'collection.mapi'],\n examples: [\n 'let cu = import(\"collection\"); cu.filteri([1, 2, 3], (x, i) -> i % 2 == 0)',\n 'let cu = import(\"collection\"); cu.filteri([1, 2, 3], (x, i) -> x % 2 == 0)',\n 'let cu = import(\"collection\"); cu.filteri([1, 2, 3], (x, i) -> x + i > 3)',\n ],\n },\n },\n 'mapi': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): MaybePromise<Coll> => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n if (Array.isArray(coll)) {\n return mapSequential(coll, (elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo))\n }\n if (typeof coll === 'string') {\n return chain(\n mapSequential(coll.split(''), (elem, index) => executeFunction(fn, [elem, index], contextStack, sourceCodeInfo)),\n mapped => mapped.join(''),\n )\n }\n const entries = Object.entries(coll)\n return reduceSequential(entries, (acc: Obj, [key, value]) => {\n return chain(executeFunction(fn, [value, key], contextStack, sourceCodeInfo), (result) => {\n acc[key] = result\n return acc\n })\n }, {})\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'collection' },\n args: {\n a: { type: 'collection' },\n b: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take two arguments: the element itself and the index.',\n },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Creates a new collection populated with the results of calling $b on every element in $a. The function is called for each element in the collection, and it should take two arguments: the element itself and the index.',\n seeAlso: ['map', 'collection.filteri'],\n examples: [\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x + i)',\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x * i)',\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x - i)',\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x / i)',\n 'let cu = import(\"collection\"); cu.mapi([1, 2, 3], (x, i) -> x % inc(i))',\n ],\n },\n },\n 'reducei': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): MaybePromise<Any> => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n assertString(initial, sourceCodeInfo)\n if (coll.length === 0)\n return initial\n\n return reduceSequential(\n coll.split('').map((elem, index) => ({ elem, index })),\n (result, { elem, index }) => executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo),\n initial as Any,\n )\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return reduceSequential(\n coll.map((elem, index) => ({ elem, index })),\n (result, { elem, index }) => executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo),\n initial,\n )\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return reduceSequential(\n Object.entries(coll),\n (result, [key, elem]) => executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo),\n initial,\n )\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n coll: { type: 'collection' },\n fun: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take three arguments: the accumulator, the element itself, and the index.',\n },\n initial: {\n type: 'any',\n description: 'The initial value to use as the accumulator.',\n },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value. The function is called for each element in the collection, and it should take three arguments: the accumulator, the element itself, and the index.',\n seeAlso: ['reduce', 'collection.reducei-right', 'collection.reductionsi'],\n examples: [\n 'let cu = import(\"collection\"); cu.reducei([1, 2, 3], (acc, x, i) -> acc + x + i, 0)',\n 'let cu = import(\"collection\"); cu.reducei(\"Albert\", (acc, x, i) -> acc ++ x ++ i, \"\")',\n 'let cu = import(\"collection\"); cu.reducei({ a: 1, b: 2 }, -> $1 ++ $3, \"\")',\n ],\n },\n },\n 'reduce-right': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): MaybePromise<Any> => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n if (coll.length === 0)\n return initial\n\n return reduceSequential(\n Array.from(coll.split('')).reverse(),\n (result, elem) => executeFunction(fn, [result, elem], contextStack, sourceCodeInfo),\n initial,\n )\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return reduceSequential(\n Array.from(coll).reverse(),\n (result, elem) => executeFunction(fn, [result, elem], contextStack, sourceCodeInfo),\n initial,\n )\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return reduceSequential(\n Object.entries(coll).reverse(),\n (result, [, elem]) => executeFunction(fn, [result, elem], contextStack, sourceCodeInfo),\n initial,\n )\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n fun: { type: 'function' },\n coll: { type: 'collection' },\n initial: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll (starting from the last item), passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value.',\n seeAlso: ['reduce', 'collection.reducei-right'],\n examples: [\n 'let cu = import(\"collection\"); cu.reduce-right([\"A\", \"B\", \"C\"], str, \"\")',\n 'let cu = import(\"collection\"); cu.reduce-right({ a: 1, b: 2 }, +, 0)',\n ],\n },\n },\n 'reducei-right': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): MaybePromise<Any> => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n if (typeof coll === 'string') {\n if (coll.length === 0)\n return initial\n\n return reduceSequential(\n Array.from(coll.split('')).reverse().map((elem, _, arr) => ({ elem, index: arr.length - 1 - _ })),\n (result, { elem, index }) => executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo),\n initial,\n )\n }\n else if (Array.isArray(coll)) {\n if (coll.length === 0)\n return initial\n\n return reduceSequential(\n Array.from(coll).reverse().map((elem, _, arr) => ({ elem, index: arr.length - 1 - _ })),\n (result, { elem, index }) => executeFunction(fn, [result, elem, index], contextStack, sourceCodeInfo),\n initial,\n )\n }\n else {\n if (Object.keys(coll).length === 0)\n return initial\n\n return reduceSequential(\n Object.entries(coll).reverse(),\n (result, [key, elem]) => executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo),\n initial,\n )\n }\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any' },\n args: {\n coll: { type: 'collection' },\n fun: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take three arguments: the accumulator, the element itself, and the index.',\n },\n initial: {\n type: 'any',\n description: 'The initial value to use as the accumulator.',\n },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Runs $fun function on each element of the $coll (starting from the last item), passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the $coll is a single value. The function is called for each element in the collection, and it should take three arguments: the accumulator, the element itself, and the index.',\n seeAlso: ['collection.reducei', 'collection.reduce-right'],\n examples: [\n 'let cu = import(\"collection\"); cu.reducei-right([1, 2, 3], (acc, x, i) -> acc + x + i, 0)',\n 'let cu = import(\"collection\"); cu.reducei-right(\"Albert\", (acc, x, i) -> acc ++ x ++ i, \"\")',\n 'let cu = import(\"collection\"); cu.reducei-right({ a: 1, b: 2 }, -> $1 ++ $3, \"\")',\n ],\n },\n },\n 'reductions': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): MaybePromise<Any> => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n assertAny(initial, sourceCodeInfo)\n\n const items: Any[] = typeof coll === 'string'\n ? (assertString(initial, sourceCodeInfo), coll.length === 0 ? [] : coll.split(''))\n : Array.isArray(coll)\n ? (coll.length === 0 ? [] : Array.from(coll) as Any[])\n : (Object.keys(coll).length === 0 ? [] : Object.entries(coll).map(([, v]) => v as Any))\n\n if (items.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n return chain(\n reduceSequential(\n items,\n (result, elem) => {\n return chain(executeFunction(fn, [result, elem], contextStack, sourceCodeInfo), (newVal) => {\n resultArray.push(newVal)\n return newVal\n })\n },\n initial,\n ),\n () => resultArray,\n )\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any', array: true },\n args: {\n fun: { type: 'function' },\n coll: { type: 'collection' },\n initial: { type: 'any' },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Returns an array of the intermediate values of the reduction (see `reduce`) of $coll by $fun.',\n seeAlso: ['reduce', 'collection.reductionsi'],\n examples: [\n 'let cu = import(\"collection\"); cu.reductions([1, 2, 3], +, 0)',\n 'let cu = import(\"collection\"); cu.reductions([1, 2, 3], +, 10)',\n 'let cu = import(\"collection\"); cu.reductions([], +, 0)',\n 'let cu = import(\"collection\"); cu.reductions({ a: 1, b: 2 }, +, 0)',\n `\nlet cu = import(\"collection\");\ncu.reductions(\n [1, 2, 3, 4, 5, 6, 7, 8, 9],\n (result, value) -> result + (even?(value) ? value : 0),\n 0\n)`,\n ],\n },\n },\n 'reductionsi': {\n evaluate: ([coll, fn, initial], sourceCodeInfo, contextStack, { executeFunction }): MaybePromise<Any> => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n assertAny(initial, sourceCodeInfo)\n\n assertAny(initial, sourceCodeInfo)\n\n type IndexedItem = { elem: Any, key: string | number }\n const toIndexedItem = (elem: Any, key: string | number): IndexedItem => ({ elem, key })\n const items: IndexedItem[] = typeof coll === 'string'\n ? (assertString(initial, sourceCodeInfo), coll.length === 0 ? [] : coll.split('').map((elem, index) => toIndexedItem(elem, index)))\n : Array.isArray(coll)\n ? (coll.length === 0 ? [] : coll.map((elem, index) => toIndexedItem(elem as Any, index)))\n : (Object.keys(coll).length === 0 ? [] : Object.entries(coll).map(([key, v]) => toIndexedItem(v as Any, key)))\n\n if (items.length === 0)\n return [initial]\n\n const resultArray: Any[] = [initial]\n return chain(\n reduceSequential(\n items,\n (result, { elem, key }) => {\n return chain(executeFunction(fn, [result, elem, key], contextStack, sourceCodeInfo), (newVal) => {\n resultArray.push(newVal)\n return newVal\n })\n },\n initial,\n ),\n () => resultArray,\n )\n },\n arity: toFixedArity(3),\n docs: {\n category: 'collection',\n returns: { type: 'any', array: true },\n args: {\n coll: { type: 'collection' },\n fun: {\n type: 'function',\n description: 'The function to call for each element in the collection. The function should take three arguments: the accumulator, the element itself, and the index.',\n },\n initial: {\n type: 'any',\n description: 'The initial value to use as the accumulator.',\n },\n },\n variants: [{ argumentNames: ['coll', 'fun', 'initial'] }],\n description: 'Returns an array of the intermediate values of the reduction (see `reduce`) of $coll by $fun. The function is called for each element in the collection, and it should take three arguments: the accumulator, the element itself, and the index.',\n seeAlso: ['collection.reductions', 'collection.reducei'],\n examples: [\n 'let cu = import(\"collection\"); cu.reductionsi([1, 2, 3], (acc, x, i) -> acc + x + i, 0)',\n 'let cu = import(\"collection\"); cu.reductionsi(\"Albert\", (acc, x, i) -> acc ++ x ++ i, \"\")',\n 'let cu = import(\"collection\"); cu.reductionsi({ a: 1, b: 2 }, -> $1 ++ $3, \"\")',\n ],\n },\n },\n 'not-empty': {\n evaluate: ([coll], sourceCodeInfo): Coll | null => {\n if (coll === null)\n return null\n\n assertColl(coll, sourceCodeInfo)\n if (typeof coll === 'string')\n return coll.length > 0 ? coll : null\n\n if (Array.isArray(coll))\n return coll.length > 0 ? coll : null\n\n return Object.keys(coll).length > 0 ? coll : null\n },\n arity: toFixedArity(1),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n coll: { type: ['collection', 'null'] },\n },\n variants: [{ argumentNames: ['coll'] }],\n description: 'Returns `null` if $coll is empty or `null`, otherwise $coll.',\n seeAlso: ['empty?', 'not-empty?'],\n examples: [\n 'let cu = import(\"collection\"); cu.not-empty([])',\n 'let cu = import(\"collection\"); cu.not-empty([1, 2, 3])',\n 'let cu = import(\"collection\"); cu.not-empty({})',\n 'let cu = import(\"collection\"); cu.not-empty({ a: 2 })',\n 'let cu = import(\"collection\"); cu.not-empty(\"\")',\n 'let cu = import(\"collection\"); cu.not-empty(\"Albert\")',\n 'let cu = import(\"collection\"); cu.not-empty(null)',\n ],\n },\n },\n 'every?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): MaybePromise<boolean> => {\n assertColl(coll, sourceCodeInfo)\n assertFunctionLike(fn, sourceCodeInfo)\n\n const arr = Array.isArray(coll)\n ? coll\n : typeof coll === 'string'\n ? coll.split('')\n : Object.entries(coll)\n\n return everySequential(arr, elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if all entries in $a pass the test implemented by $b, otherwise returns `false`.',\n seeAlso: ['collection.any?', 'collection.not-every?', 'collection.not-any?', 'functional.every-pred', 'grid.every?'],\n examples: [\n 'let cu = import(\"collection\"); cu.every?([1, 2, 3], number?)',\n 'let cu = import(\"collection\"); cu.every?([1, 2, 3], even?)',\n `\nlet cu = import(\"collection\");\ncu.every?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?,\n)`,\n `\nlet cu = import(\"collection\");\ncu.every?(\n [50, 100, 150, 200],\n -> $ > 10,\n)`,\n 'let cu = import(\"collection\"); cu.every?([], number?)',\n 'let cu = import(\"collection\"); cu.every?(\"\", number?)',\n 'let cu = import(\"collection\"); cu.every?({}, number?)',\n `\nlet cu = import(\"collection\");\ncu.every?(\n { a: 2, b: 4},\n -> even?(second($))\n)`,\n `\nlet cu = import(\"collection\");\ncu.every?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n 'any?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): MaybePromise<boolean> => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertColl(coll, sourceCodeInfo)\n\n const arr = Array.isArray(coll)\n ? coll\n : typeof coll === 'string'\n ? coll.split('')\n : Object.entries(coll)\n\n return someSequential(arr, elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo))\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if any element in $a pass the test implemented by $b, otherwise returns `false`.',\n seeAlso: ['collection.every?', 'collection.not-any?', 'collection.not-every?', 'functional.some-pred', 'some', 'grid.some?'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.any?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nlet cu = import(\"collection\");\ncu.any?(\n [50, 100, 150, 200],\n x -> x > 10\n)`,\n 'let cu = import(\"collection\"); cu.any?([], number?)',\n 'let cu = import(\"collection\"); cu.any?(\"\", number?)',\n 'let cu = import(\"collection\"); cu.any?({}, number?)',\n `\nlet cu = import(\"collection\");\ncu.any?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n `\nlet cu = import(\"collection\");\ncu.any?(\n { a: 1, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n 'not-any?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): MaybePromise<boolean> => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertColl(coll, sourceCodeInfo)\n\n const arr = Array.isArray(coll)\n ? coll\n : typeof coll === 'string'\n ? coll.split('')\n : Object.entries(coll)\n\n return chain(\n someSequential(arr, elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo)),\n result => !result,\n )\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `false` if any element in $a pass the test implemented by $b, otherwise returns `true`.',\n seeAlso: ['collection.any?', 'collection.every?', 'collection.not-every?'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.not-any?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nlet cu = import(\"collection\");\ncu.not-any?(\n [50, 100, 150, 200],\n x -> x > 10\n)`,\n 'let cu = import(\"collection\"); cu.not-any?([], number?)',\n 'let cu = import(\"collection\"); cu.not-any?(\"\", number?)',\n 'let cu = import(\"collection\"); cu.not-any?({}, number?)',\n `\nlet cu = import(\"collection\");\ncu.not-any?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n `\nlet cu = import(\"collection\");\ncu.not-any?(\n { a: 1, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n 'not-every?': {\n evaluate: ([coll, fn], sourceCodeInfo, contextStack, { executeFunction }): MaybePromise<boolean> => {\n assertFunctionLike(fn, sourceCodeInfo)\n assertColl(coll, sourceCodeInfo)\n\n const arr = Array.isArray(coll)\n ? coll\n : typeof coll === 'string'\n ? coll.split('')\n : Object.entries(coll)\n\n return chain(\n everySequential(arr, elem => executeFunction(fn, [elem], contextStack, sourceCodeInfo)),\n result => !result,\n )\n },\n arity: toFixedArity(2),\n docs: {\n category: 'collection',\n returns: { type: 'boolean' },\n args: {\n a: { type: 'collection' },\n b: { type: 'function' },\n },\n variants: [{ argumentNames: ['a', 'b'] }],\n description: 'Returns `true` if at least one element in $a does not pass the test implemented by $b, otherwise returns `false`.',\n seeAlso: ['collection.every?', 'collection.any?', 'collection.not-any?'],\n examples: [\n `\nlet cu = import(\"collection\");\ncu.not-every?(\n [\"Albert\", \"Mojir\", 160, [1, 2]],\n string?\n)`,\n `\nlet cu = import(\"collection\");\ncu.not-every?(\n [50, 100, 150, 200],\n x -> x > 10\n)`,\n 'let cu = import(\"collection\"); cu.not-every?([], number?)',\n 'let cu = import(\"collection\"); cu.not-every?(\"\", number?)',\n 'let cu = import(\"collection\"); cu.not-every?({}, number?)',\n `\nlet cu = import(\"collection\");\ncu.not-every?(\n { a: 2, b: 4 },\n -> even?(second($))\n)`,\n `\nlet cu = import(\"collection\");\ncu.not-every?(\n { a: 2, b: 3 },\n -> even?(second($))\n)`,\n ],\n },\n },\n}\n\nexport const collectionUtilsModule: LitsModule = {\n name: 'collection',\n functions: collectionUtilsFunctions,\n}\n"],"names":["getCodeMarker","sourceCodeInfo","position","code","leftPadding","column","rightPadding","length","repeat","Math","max","LitsError","Error","shortMessage","constructor","err","message","super","location","line","filePath","getLitsErrorMessage","this","Object","setPrototypeOf","prototype","name","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","functionTypeSet","FUNCTION_SYMBOL","REGEXP_SYMBOL","isLitsFunction","func","type","functionType","has","isNode","value","Array","isArray","valueToString","keys","find","key","RegExp","toString","JSON","stringify","getSourceCodeInfo","anyValue","getAssertionError","typeName","assertAny","undefined","isAny","isObj","regexp","isColl","isSeq","asColl","assertColl","assertFunctionLike","isFunctionLike","isNumber","options","isNaN","integer","isInteger","finite","isFinite","zero","nonZero","positive","negative","nonPositive","nonNegative","gt","gte","lt","lte","assertNumber","sign","getSignString","numberType","range","getRangeString","filter","x","join","getNumberTypeName","assertString","nonEmpty","char","isString","asStringOrNumber","assertStringOrNumber","isStringOrNumber","collHasKey","coll","getOwnPropertyDescriptor","toAny","clone","entries","reduce","result","entry","val","map","item","cloneColl","assertArray","toFixedArity","arity","min","chain","fn","Promise","then","mapSequential","arr","results","i","chainRemainingMap","push","async","currentPromise","startIndex","reduceSequential","initial","next","chainRemainingReduce","someSequential","chainRemainingSome","everySequential","chainRemainingEvery","filterSequential","chainRemainingFilter","get","assoc","slice","copy","update","params","contextStack","executeFunction","intKey","num","ceil","from","_","index","chars","split","asString","cloneAndGetMeta","originalColl","innerCollMeta","resultColl","newResultColl","assertObj","parent","collectionUtilsModule","functions","evaluate","defaultValue","nextValue","docs","category","returns","args","a","b","variants","argumentNames","description","seeAlso","examples","lastKey","parentKey","ks","array","fun","rest","updated","filteri","elem","filtered","mapi","mapped","acc","reducei","reverse","reductions","items","v","resultArray","newVal","reductionsi","toIndexedItem"],"mappings":"aAEM,SAAUA,EAAcC,GAC5B,IAAKA,EAAeC,WAAaD,EAAeE,KAC9C,MAAO,GAET,MAAMC,EAAcH,EAAeC,SAASG,OAAS,EAC/CC,EAAeL,EAAeE,KAAKI,OAASH,EAAc,EAChE,MAAO,GAAG,IAAII,OAAOC,KAAKC,IAAIN,EAAa,OAAO,IAAII,OAAOC,KAAKC,IAAIJ,EAAc,KACtF,CCkBM,MAAOK,UAAkBC,MACbX,eACAY,aAChB,WAAAC,CAAYC,EAAcd,GACxB,MAAMe,EAAUD,aAAeH,MAC3BG,EAAIC,QACJ,GAAGD,IAEPE,MA/BJ,SAA6BD,EAAiBf,GAC5C,IAAKA,EACH,OAAOe,EAET,MAAME,EAAW,GAAGjB,EAAeC,SAASiB,QAAQlB,EAAeC,SAASG,SAM5E,MAAO,GAAGW,IALWf,EAAemB,SAChC,KAAKnB,EAAemB,YAAYF,IAChC,cAAcA,QACIjB,EAAeE,SACbH,EAAcC,IAExC,CAoBUoB,CAAoBL,EAASf,IACnCqB,KAAKT,aAAeG,EACpBM,KAAKrB,eAAiBA,EACtBsB,OAAOC,eAAeF,KAAMX,EAAUc,WACtCH,KAAKI,KAAO,WACb,CAEM,a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