@mojir/lits 2.2.2-alpha.6 → 2.2.2
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 +1556 -107
- package/dist/cli/cli/src/cli.d.ts +1 -1
- package/dist/cli/cli/src/cliDocumentation/getCliType.d.ts +1 -1
- package/dist/cli/cli/src/colorizer.d.ts +36 -36
- package/dist/cli/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
- package/dist/cli/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
- package/dist/cli/cli/src/js-interop/Cli/index.d.ts +3 -0
- package/dist/cli/cli/src/js-interop/utils.d.ts +2 -0
- package/dist/cli/cli.js +30531 -12755
- package/dist/cli/reference/api.d.ts +53 -41
- package/dist/cli/reference/index.d.ts +150 -23
- package/dist/cli/src/AutoCompleter/AutoCompleter.d.ts +24 -0
- package/dist/cli/src/Lits/Cache.d.ts +1 -1
- package/dist/cli/src/Lits/Lits.d.ts +26 -22
- package/dist/cli/src/allModules.d.ts +2 -0
- package/dist/cli/src/builtin/bindingNode.d.ts +5 -0
- package/dist/cli/src/builtin/{normalExpressions/categories → core}/array.d.ts +1 -1
- package/dist/cli/src/builtin/{normalExpressions/categories → core}/bitwise.d.ts +1 -1
- package/dist/{src/builtin/normalExpressions/categories → cli/src/builtin/core}/collection.d.ts +1 -1
- package/dist/{src/builtin/normalExpressions/categories → cli/src/builtin/core}/functional.d.ts +1 -1
- package/dist/{src/builtin/normalExpressions/categories → cli/src/builtin/core}/math.d.ts +1 -1
- package/dist/cli/src/builtin/core/meta.d.ts +3 -0
- package/dist/cli/src/builtin/{normalExpressions/categories → core}/misc.d.ts +1 -1
- package/dist/{src/builtin/normalExpressions/categories → cli/src/builtin/core}/object.d.ts +1 -1
- package/dist/{src/builtin/normalExpressions/categories → cli/src/builtin/core}/predicates.d.ts +1 -1
- package/dist/{src/builtin/normalExpressions/categories → cli/src/builtin/core}/regexp.d.ts +1 -1
- package/dist/cli/src/builtin/core/sequence.d.ts +2 -0
- package/dist/cli/src/builtin/{normalExpressions/categories → core}/string.d.ts +1 -1
- package/dist/cli/src/builtin/core/vector.d.ts +2 -0
- package/dist/cli/src/builtin/index.d.ts +10 -34
- package/dist/cli/src/builtin/interface.d.ts +92 -24
- package/dist/cli/src/builtin/modules/assert/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/assert/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/bitwise/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/collection/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/functional/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/grid/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/grid/fromArray.d.ts +8 -0
- package/dist/cli/src/builtin/modules/grid/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/grid/transpose.d.ts +2 -0
- package/dist/cli/src/builtin/modules/interface.d.ts +11 -0
- package/dist/cli/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
- package/dist/cli/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
- package/dist/cli/src/builtin/modules/linear-algebra/index.d.ts +4 -0
- package/dist/cli/src/builtin/modules/math/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/matrix/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
- package/dist/cli/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
- package/dist/cli/src/builtin/modules/matrix/index.d.ts +4 -0
- package/dist/cli/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/combinations.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/derangements.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/divisors.d.ts +4 -0
- package/dist/cli/src/builtin/modules/number-theory/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/factorial.d.ts +3 -0
- package/dist/cli/src/builtin/modules/number-theory/index.d.ts +4 -0
- package/dist/cli/src/builtin/modules/number-theory/partitions.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/permutations.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/index.d.ts +26 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
- package/dist/cli/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
- package/dist/cli/src/builtin/modules/random/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/random/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/sequence/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/string/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/bincount.d.ts +9 -0
- package/dist/cli/src/builtin/modules/vector/calcMad.d.ts +1 -0
- package/dist/cli/src/builtin/modules/vector/calcMean.d.ts +1 -0
- package/dist/cli/src/builtin/modules/vector/calcMedad.d.ts +1 -0
- package/dist/cli/src/builtin/modules/vector/calcMedian.d.ts +1 -0
- package/dist/cli/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/calcVariance.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/docs.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/entropy.d.ts +8 -0
- package/dist/cli/src/builtin/modules/vector/histogram.d.ts +9 -0
- package/dist/cli/src/builtin/modules/vector/index.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/mode.d.ts +6 -0
- package/dist/cli/src/builtin/modules/vector/outliers.d.ts +7 -0
- package/dist/cli/src/builtin/modules/vector/percentile.d.ts +7 -0
- package/dist/cli/src/builtin/modules/vector/quartiles.d.ts +1 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
- package/dist/cli/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
- package/dist/cli/src/builtin/normalExpressions/index.d.ts +7 -1
- package/dist/cli/src/builtin/specialExpressionTypes.d.ts +23 -0
- package/dist/cli/src/builtin/specialExpressions/and.d.ts +3 -3
- package/dist/cli/src/builtin/specialExpressions/array.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/block.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/cond.d.ts +3 -3
- package/dist/cli/src/builtin/specialExpressions/def.d.ts +5 -4
- package/dist/cli/src/builtin/specialExpressions/defined.d.ts +5 -0
- package/dist/cli/src/builtin/specialExpressions/functions.d.ts +5 -17
- package/dist/cli/src/builtin/specialExpressions/if.d.ts +3 -3
- package/dist/cli/src/builtin/specialExpressions/let.d.ts +3 -7
- package/dist/cli/src/builtin/specialExpressions/loop.d.ts +3 -4
- package/dist/cli/src/builtin/specialExpressions/loops.d.ts +5 -14
- package/dist/cli/src/builtin/specialExpressions/object.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/or.d.ts +3 -3
- package/dist/cli/src/builtin/specialExpressions/qq.d.ts +3 -3
- package/dist/cli/src/builtin/specialExpressions/recur.d.ts +3 -3
- package/dist/cli/src/builtin/specialExpressions/switch.d.ts +6 -0
- package/dist/cli/src/builtin/specialExpressions/throw.d.ts +3 -3
- package/dist/cli/src/builtin/specialExpressions/try.d.ts +3 -5
- package/dist/cli/src/builtin/specialExpressions/unless.d.ts +6 -0
- package/dist/cli/src/builtin/utils.d.ts +3 -15
- package/dist/cli/src/cli.d.ts +1 -1
- package/dist/cli/src/cliDocumentation/getCliType.d.ts +1 -1
- package/dist/cli/src/colorizer.d.ts +36 -36
- package/dist/cli/src/constants/constants.d.ts +18 -44
- package/dist/cli/src/errors.d.ts +2 -5
- package/dist/cli/src/evaluator/ContextStack.d.ts +16 -11
- package/dist/cli/src/evaluator/functionExecutors.d.ts +4 -4
- package/dist/cli/src/evaluator/index.d.ts +2 -2
- package/dist/cli/src/evaluator/interface.d.ts +5 -5
- package/dist/cli/src/getUndefinedSymbols/index.d.ts +7 -0
- package/dist/cli/src/index.d.ts +9 -12
- package/dist/cli/src/initReferenceData.d.ts +1 -0
- package/dist/cli/src/interface.d.ts +1 -2
- package/dist/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
- package/dist/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
- package/dist/cli/src/js-interop/Cli/index.d.ts +3 -0
- package/dist/cli/src/js-interop/utils.d.ts +2 -0
- package/dist/cli/src/parser/Parser.d.ts +58 -0
- package/dist/cli/src/parser/types.d.ts +133 -0
- package/dist/cli/src/symbolPatterns.d.ts +2 -0
- package/dist/cli/src/tokenizer/minifyTokenStream.d.ts +4 -0
- package/dist/cli/src/tokenizer/operators.d.ts +12 -0
- package/dist/cli/src/tokenizer/reservedNames.d.ts +66 -0
- package/dist/cli/src/tokenizer/token.d.ts +86 -0
- package/dist/cli/src/tokenizer/tokenize.d.ts +8 -0
- package/dist/cli/src/tokenizer/tokenizers.d.ts +14 -19
- package/dist/cli/src/transformer/index.d.ts +2 -2
- package/dist/cli/src/typeGuards/annotatedArrays.d.ts +16 -0
- package/dist/cli/src/typeGuards/array.d.ts +1 -1
- package/dist/cli/src/typeGuards/astNode.d.ts +20 -17
- package/dist/cli/src/typeGuards/index.d.ts +1 -10
- package/dist/cli/src/typeGuards/lits.d.ts +5 -2
- package/dist/cli/src/typeGuards/litsFunction.d.ts +3 -3
- package/dist/cli/src/typeGuards/number.d.ts +1 -1
- package/dist/cli/src/typeGuards/string.d.ts +1 -1
- package/dist/cli/src/untokenizer/index.d.ts +1 -1
- package/dist/cli/src/utils/arity.d.ts +10 -0
- package/dist/cli/src/utils/debug/debugTools.d.ts +0 -2
- package/dist/cli/src/utils/debug/getCodeMarker.d.ts +2 -0
- package/dist/cli/src/utils/debug/getSourceCodeInfo.d.ts +2 -2
- package/dist/cli/src/utils/docString/generateDocString.d.ts +2 -0
- package/dist/cli/src/utils/getAssertionError.d.ts +1 -1
- package/dist/cli/src/utils/index.d.ts +9 -6
- package/dist/full.esm.js +2 -0
- package/dist/full.esm.js.map +1 -0
- package/dist/full.js +2 -0
- package/dist/full.js.map +1 -0
- package/dist/index.esm.js +1 -15635
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -15663
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +1 -15668
- package/dist/lits.iife.js.map +1 -1
- package/dist/modules/assert.esm.js +2 -0
- package/dist/modules/assert.esm.js.map +1 -0
- package/dist/modules/assert.js +2 -0
- package/dist/modules/assert.js.map +1 -0
- package/dist/modules/bitwise.esm.js +2 -0
- package/dist/modules/bitwise.esm.js.map +1 -0
- package/dist/modules/bitwise.js +2 -0
- package/dist/modules/bitwise.js.map +1 -0
- package/dist/modules/cli/src/cli.d.ts +2 -0
- package/dist/modules/cli/src/cliDocumentation/formatCliDescription.d.ts +3 -0
- package/dist/modules/cli/src/cliDocumentation/getCliArgumentInfo.d.ts +3 -0
- package/dist/modules/cli/src/cliDocumentation/getCliDocumentation.d.ts +2 -0
- package/dist/modules/cli/src/cliDocumentation/getCliFunctionExamples.d.ts +3 -0
- package/dist/modules/cli/src/cliDocumentation/getCliFunctionSignature.d.ts +3 -0
- package/dist/modules/cli/src/cliDocumentation/getCliTitle.d.ts +3 -0
- package/dist/modules/cli/src/cliDocumentation/getCliType.d.ts +3 -0
- package/dist/modules/cli/src/cliFormatterRules.d.ts +13 -0
- package/dist/modules/cli/src/colorizer.d.ts +939 -0
- package/dist/modules/cli/src/createReadlineInterface.d.ts +5 -0
- package/dist/modules/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
- package/dist/modules/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
- package/dist/modules/cli/src/js-interop/Cli/index.d.ts +3 -0
- package/dist/modules/cli/src/js-interop/utils.d.ts +2 -0
- package/dist/modules/collection.esm.js +2 -0
- package/dist/modules/collection.esm.js.map +1 -0
- package/dist/modules/collection.js +2 -0
- package/dist/modules/collection.js.map +1 -0
- package/dist/modules/common/createFormatter.d.ts +6 -0
- package/dist/modules/common/utils.d.ts +2 -0
- package/dist/modules/functional.esm.js +2 -0
- package/dist/modules/functional.esm.js.map +1 -0
- package/dist/modules/functional.js +2 -0
- package/dist/modules/functional.js.map +1 -0
- package/dist/modules/grid.esm.js +2 -0
- package/dist/modules/grid.esm.js.map +1 -0
- package/dist/modules/grid.js +2 -0
- package/dist/modules/grid.js.map +1 -0
- package/dist/modules/linear-algebra.esm.js +2 -0
- package/dist/modules/linear-algebra.esm.js.map +1 -0
- package/dist/modules/linear-algebra.js +2 -0
- package/dist/modules/linear-algebra.js.map +1 -0
- package/dist/modules/math.esm.js +2 -0
- package/dist/modules/math.esm.js.map +1 -0
- package/dist/modules/math.js +2 -0
- package/dist/modules/math.js.map +1 -0
- package/dist/modules/matrix.esm.js +2 -0
- package/dist/modules/matrix.esm.js.map +1 -0
- package/dist/modules/matrix.js +2 -0
- package/dist/modules/matrix.js.map +1 -0
- package/dist/modules/number-theory.esm.js +2 -0
- package/dist/modules/number-theory.esm.js.map +1 -0
- package/dist/modules/number-theory.js +2 -0
- package/dist/modules/number-theory.js.map +1 -0
- package/dist/modules/random.esm.js +2 -0
- package/dist/modules/random.esm.js.map +1 -0
- package/dist/modules/random.js +2 -0
- package/dist/modules/random.js.map +1 -0
- package/dist/modules/reference/api.d.ts +71 -0
- package/dist/modules/reference/datatype.d.ts +3 -0
- package/dist/modules/reference/index.d.ts +178 -0
- package/dist/modules/reference/shorthand.d.ts +3 -0
- package/dist/modules/sequence.esm.js +2 -0
- package/dist/modules/sequence.esm.js.map +1 -0
- package/dist/modules/sequence.js +2 -0
- package/dist/modules/sequence.js.map +1 -0
- package/dist/modules/src/AutoCompleter/AutoCompleter.d.ts +24 -0
- package/dist/modules/src/Lits/Cache.d.ts +16 -0
- package/dist/modules/src/Lits/Lits.d.ts +58 -0
- package/dist/modules/src/allModules.d.ts +2 -0
- package/dist/modules/src/builtin/bindingNode.d.ts +5 -0
- package/dist/{src/builtin/normalExpressions/categories → modules/src/builtin/core}/array.d.ts +1 -1
- package/dist/{src/builtin/normalExpressions/categories → modules/src/builtin/core}/bitwise.d.ts +1 -1
- package/dist/{cli/src/builtin/normalExpressions/categories → modules/src/builtin/core}/collection.d.ts +1 -1
- package/dist/{cli/src/builtin/normalExpressions/categories → modules/src/builtin/core}/functional.d.ts +1 -1
- package/dist/{cli/src/builtin/normalExpressions/categories → modules/src/builtin/core}/math.d.ts +1 -1
- package/dist/modules/src/builtin/core/meta.d.ts +3 -0
- package/dist/{src/builtin/normalExpressions/categories → modules/src/builtin/core}/misc.d.ts +1 -1
- package/dist/{cli/src/builtin/normalExpressions/categories → modules/src/builtin/core}/object.d.ts +1 -1
- package/dist/{cli/src/builtin/normalExpressions/categories → modules/src/builtin/core}/predicates.d.ts +1 -1
- package/dist/{cli/src/builtin/normalExpressions/categories → modules/src/builtin/core}/regexp.d.ts +1 -1
- package/dist/modules/src/builtin/core/sequence.d.ts +2 -0
- package/dist/{src/builtin/normalExpressions/categories → modules/src/builtin/core}/string.d.ts +1 -1
- package/dist/modules/src/builtin/core/vector.d.ts +2 -0
- package/dist/modules/src/builtin/index.d.ts +14 -0
- package/dist/modules/src/builtin/interface.d.ts +110 -0
- package/dist/modules/src/builtin/modules/assert/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/assert/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/bitwise/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/collection/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/functional/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/grid/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/grid/fromArray.d.ts +8 -0
- package/dist/modules/src/builtin/modules/grid/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/grid/transpose.d.ts +2 -0
- package/dist/modules/src/builtin/modules/interface.d.ts +11 -0
- package/dist/modules/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
- package/dist/modules/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
- package/dist/modules/src/builtin/modules/linear-algebra/index.d.ts +4 -0
- package/dist/modules/src/builtin/modules/math/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/matrix/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/diagonal.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
- package/dist/modules/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
- package/dist/modules/src/builtin/modules/matrix/index.d.ts +4 -0
- package/dist/modules/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/combinations.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/derangements.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/divisors.d.ts +4 -0
- package/dist/modules/src/builtin/modules/number-theory/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/factorial.d.ts +3 -0
- package/dist/modules/src/builtin/modules/number-theory/index.d.ts +4 -0
- package/dist/modules/src/builtin/modules/number-theory/partitions.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/permutations.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/index.d.ts +26 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
- package/dist/modules/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
- package/dist/modules/src/builtin/modules/random/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/random/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/sequence/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/string/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/bincount.d.ts +9 -0
- package/dist/modules/src/builtin/modules/vector/calcMad.d.ts +1 -0
- package/dist/modules/src/builtin/modules/vector/calcMean.d.ts +1 -0
- package/dist/modules/src/builtin/modules/vector/calcMedad.d.ts +1 -0
- package/dist/modules/src/builtin/modules/vector/calcMedian.d.ts +1 -0
- package/dist/modules/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/calcVariance.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/docs.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/entropy.d.ts +8 -0
- package/dist/modules/src/builtin/modules/vector/histogram.d.ts +9 -0
- package/dist/modules/src/builtin/modules/vector/index.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/mode.d.ts +6 -0
- package/dist/modules/src/builtin/modules/vector/outliers.d.ts +7 -0
- package/dist/modules/src/builtin/modules/vector/percentile.d.ts +7 -0
- package/dist/modules/src/builtin/modules/vector/quartiles.d.ts +1 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
- package/dist/modules/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
- package/dist/modules/src/builtin/normalExpressions/index.d.ts +8 -0
- package/dist/modules/src/builtin/specialExpressionTypes.d.ts +23 -0
- package/dist/modules/src/builtin/specialExpressions/and.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/array.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/block.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/cond.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/def.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/defined.d.ts +5 -0
- package/dist/modules/src/builtin/specialExpressions/functions.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/if.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/let.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/loop.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/loops.d.ts +9 -0
- package/dist/modules/src/builtin/specialExpressions/object.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/or.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/qq.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/recur.d.ts +5 -0
- package/dist/modules/src/builtin/specialExpressions/switch.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/throw.d.ts +5 -0
- package/dist/modules/src/builtin/specialExpressions/try.d.ts +6 -0
- package/dist/modules/src/builtin/specialExpressions/unless.d.ts +6 -0
- package/dist/modules/src/builtin/utils.d.ts +6 -0
- package/dist/modules/src/constants/constants.d.ts +19 -0
- package/dist/modules/src/errors.d.ts +24 -0
- package/dist/modules/src/evaluator/ContextStack.d.ts +29 -0
- package/dist/modules/src/evaluator/functionExecutors.d.ts +11 -0
- package/dist/modules/src/evaluator/index.d.ts +5 -0
- package/dist/modules/src/evaluator/interface.d.ts +12 -0
- package/dist/modules/src/full.d.ts +17 -0
- package/dist/modules/src/getUndefinedSymbols/index.d.ts +7 -0
- package/dist/modules/src/index.d.ts +14 -0
- package/dist/modules/src/initReferenceData.d.ts +1 -0
- package/dist/modules/src/interface.d.ts +7 -0
- package/dist/modules/src/modules/assert.d.ts +2 -0
- package/dist/modules/src/modules/bitwise.d.ts +2 -0
- package/dist/modules/src/modules/collection.d.ts +2 -0
- package/dist/modules/src/modules/functional.d.ts +2 -0
- package/dist/modules/src/modules/grid.d.ts +2 -0
- package/dist/modules/src/modules/linear-algebra.d.ts +2 -0
- package/dist/modules/src/modules/math.d.ts +2 -0
- package/dist/modules/src/modules/matrix.d.ts +2 -0
- package/dist/modules/src/modules/number-theory.d.ts +2 -0
- package/dist/modules/src/modules/random.d.ts +2 -0
- package/dist/modules/src/modules/sequence.d.ts +2 -0
- package/dist/modules/src/modules/string.d.ts +2 -0
- package/dist/modules/src/modules/vector.d.ts +2 -0
- package/dist/modules/src/parser/Parser.d.ts +58 -0
- package/dist/modules/src/parser/types.d.ts +133 -0
- package/dist/modules/src/symbolPatterns.d.ts +2 -0
- package/dist/modules/src/testFramework/index.d.ts +14 -0
- package/dist/modules/src/tokenizer/minifyTokenStream.d.ts +4 -0
- package/dist/modules/src/tokenizer/operators.d.ts +12 -0
- package/dist/modules/src/tokenizer/reservedNames.d.ts +66 -0
- package/dist/modules/src/tokenizer/token.d.ts +86 -0
- package/dist/modules/src/tokenizer/tokenize.d.ts +8 -0
- package/dist/modules/src/tokenizer/tokenizers.d.ts +14 -0
- package/dist/modules/src/transformer/index.d.ts +2 -0
- package/dist/modules/src/typeGuards/annotatedArrays.d.ts +16 -0
- package/dist/modules/src/typeGuards/array.d.ts +9 -0
- package/dist/modules/src/typeGuards/astNode.d.ts +20 -0
- package/dist/modules/src/typeGuards/index.d.ts +8 -0
- package/dist/modules/src/typeGuards/lits.d.ts +24 -0
- package/dist/modules/src/typeGuards/litsFunction.d.ts +12 -0
- package/dist/modules/src/typeGuards/number.d.ts +66 -0
- package/dist/modules/src/typeGuards/string.d.ts +15 -0
- package/dist/modules/src/untokenizer/index.d.ts +2 -0
- package/dist/modules/src/utils/arity.d.ts +10 -0
- package/dist/modules/src/utils/debug/debugTools.d.ts +1 -0
- package/dist/modules/src/utils/debug/getCodeMarker.d.ts +2 -0
- package/dist/modules/src/utils/debug/getSourceCodeInfo.d.ts +2 -0
- package/dist/modules/src/utils/docString/generateDocString.d.ts +2 -0
- package/dist/modules/src/utils/getAssertionError.d.ts +3 -0
- package/dist/modules/src/utils/index.d.ts +14 -0
- package/dist/modules/src/utils/symbols.d.ts +2 -0
- package/dist/modules/string.esm.js +2 -0
- package/dist/modules/string.esm.js.map +1 -0
- package/dist/modules/string.js +2 -0
- package/dist/modules/string.js.map +1 -0
- package/dist/modules/vector.esm.js +2 -0
- package/dist/modules/vector.esm.js.map +1 -0
- package/dist/modules/vector.js +2 -0
- package/dist/modules/vector.js.map +1 -0
- package/dist/reference/api.d.ts +53 -41
- package/dist/reference/index.d.ts +150 -23
- package/dist/src/AutoCompleter/AutoCompleter.d.ts +24 -0
- package/dist/src/Lits/Cache.d.ts +1 -1
- package/dist/src/Lits/Lits.d.ts +26 -22
- package/dist/src/allModules.d.ts +2 -0
- package/dist/src/builtin/bindingNode.d.ts +5 -0
- package/dist/src/builtin/core/array.d.ts +2 -0
- package/dist/src/builtin/core/bitwise.d.ts +2 -0
- package/dist/src/builtin/core/collection.d.ts +2 -0
- package/dist/src/builtin/core/functional.d.ts +2 -0
- package/dist/src/builtin/core/math.d.ts +2 -0
- package/dist/src/builtin/core/meta.d.ts +3 -0
- package/dist/src/builtin/core/misc.d.ts +2 -0
- package/dist/src/builtin/core/object.d.ts +2 -0
- package/dist/src/builtin/core/predicates.d.ts +2 -0
- package/dist/src/builtin/core/regexp.d.ts +2 -0
- package/dist/src/builtin/core/sequence.d.ts +2 -0
- package/dist/src/builtin/core/string.d.ts +2 -0
- package/dist/src/builtin/core/vector.d.ts +2 -0
- package/dist/src/builtin/index.d.ts +10 -34
- package/dist/src/builtin/interface.d.ts +92 -24
- package/dist/src/builtin/modules/assert/docs.d.ts +2 -0
- package/dist/src/builtin/modules/assert/index.d.ts +2 -0
- package/dist/src/builtin/modules/bitwise/index.d.ts +2 -0
- package/dist/src/builtin/modules/collection/index.d.ts +2 -0
- package/dist/src/builtin/modules/functional/index.d.ts +2 -0
- package/dist/src/builtin/modules/grid/docs.d.ts +2 -0
- package/dist/src/builtin/modules/grid/fromArray.d.ts +8 -0
- package/dist/src/builtin/modules/grid/index.d.ts +2 -0
- package/dist/src/builtin/modules/grid/transpose.d.ts +2 -0
- package/dist/src/builtin/modules/interface.d.ts +11 -0
- package/dist/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
- package/dist/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
- package/dist/src/builtin/modules/linear-algebra/index.d.ts +4 -0
- package/dist/src/builtin/modules/math/index.d.ts +2 -0
- package/dist/src/builtin/modules/matrix/docs.d.ts +2 -0
- package/dist/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
- package/dist/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
- package/dist/src/builtin/modules/matrix/helpers/diagonal.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
- package/dist/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
- package/dist/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
- package/dist/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
- package/dist/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
- package/dist/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
- package/dist/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
- package/dist/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
- package/dist/src/builtin/modules/matrix/index.d.ts +4 -0
- package/dist/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/combinations.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/derangements.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/divisors.d.ts +4 -0
- package/dist/src/builtin/modules/number-theory/docs.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/factorial.d.ts +3 -0
- package/dist/src/builtin/modules/number-theory/index.d.ts +4 -0
- package/dist/src/builtin/modules/number-theory/partitions.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/permutations.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
- package/dist/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
- package/dist/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/index.d.ts +26 -0
- package/dist/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
- package/dist/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
- package/dist/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
- package/dist/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
- package/dist/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
- package/dist/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
- package/dist/src/builtin/modules/random/docs.d.ts +2 -0
- package/dist/src/builtin/modules/random/index.d.ts +2 -0
- package/dist/src/builtin/modules/sequence/index.d.ts +2 -0
- package/dist/src/builtin/modules/string/index.d.ts +2 -0
- package/dist/src/builtin/modules/vector/bincount.d.ts +9 -0
- package/dist/src/builtin/modules/vector/calcMad.d.ts +1 -0
- package/dist/src/builtin/modules/vector/calcMean.d.ts +1 -0
- package/dist/src/builtin/modules/vector/calcMedad.d.ts +1 -0
- package/dist/src/builtin/modules/vector/calcMedian.d.ts +1 -0
- package/dist/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
- package/dist/src/builtin/modules/vector/calcVariance.d.ts +2 -0
- package/dist/src/builtin/modules/vector/docs.d.ts +2 -0
- package/dist/src/builtin/modules/vector/entropy.d.ts +8 -0
- package/dist/src/builtin/modules/vector/histogram.d.ts +9 -0
- package/dist/src/builtin/modules/vector/index.d.ts +2 -0
- package/dist/src/builtin/modules/vector/mode.d.ts +6 -0
- package/dist/src/builtin/modules/vector/outliers.d.ts +7 -0
- package/dist/src/builtin/modules/vector/percentile.d.ts +7 -0
- package/dist/src/builtin/modules/vector/quartiles.d.ts +1 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
- package/dist/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
- package/dist/src/builtin/normalExpressions/index.d.ts +7 -1
- package/dist/src/builtin/specialExpressionTypes.d.ts +23 -0
- package/dist/src/builtin/specialExpressions/and.d.ts +3 -3
- package/dist/src/builtin/specialExpressions/array.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/block.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/cond.d.ts +3 -3
- package/dist/src/builtin/specialExpressions/def.d.ts +5 -4
- package/dist/src/builtin/specialExpressions/defined.d.ts +5 -0
- package/dist/src/builtin/specialExpressions/functions.d.ts +5 -17
- package/dist/src/builtin/specialExpressions/if.d.ts +3 -3
- package/dist/src/builtin/specialExpressions/let.d.ts +3 -7
- package/dist/src/builtin/specialExpressions/loop.d.ts +3 -4
- package/dist/src/builtin/specialExpressions/loops.d.ts +5 -14
- package/dist/src/builtin/specialExpressions/object.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/or.d.ts +3 -3
- package/dist/src/builtin/specialExpressions/qq.d.ts +3 -3
- package/dist/src/builtin/specialExpressions/recur.d.ts +3 -3
- package/dist/src/builtin/specialExpressions/switch.d.ts +6 -0
- package/dist/src/builtin/specialExpressions/throw.d.ts +3 -3
- package/dist/src/builtin/specialExpressions/try.d.ts +3 -5
- package/dist/src/builtin/specialExpressions/unless.d.ts +6 -0
- package/dist/src/builtin/utils.d.ts +3 -15
- package/dist/src/constants/constants.d.ts +18 -44
- package/dist/src/errors.d.ts +2 -5
- package/dist/src/evaluator/ContextStack.d.ts +16 -11
- package/dist/src/evaluator/functionExecutors.d.ts +4 -4
- package/dist/src/evaluator/index.d.ts +2 -2
- package/dist/src/evaluator/interface.d.ts +5 -5
- package/dist/src/full.d.ts +17 -0
- package/dist/src/getUndefinedSymbols/index.d.ts +7 -0
- package/dist/src/index.d.ts +9 -12
- package/dist/src/initReferenceData.d.ts +1 -0
- package/dist/src/interface.d.ts +1 -2
- package/dist/src/modules/assert.d.ts +2 -0
- package/dist/src/modules/bitwise.d.ts +2 -0
- package/dist/src/modules/collection.d.ts +2 -0
- package/dist/src/modules/functional.d.ts +2 -0
- package/dist/src/modules/grid.d.ts +2 -0
- package/dist/src/modules/linear-algebra.d.ts +2 -0
- package/dist/src/modules/math.d.ts +2 -0
- package/dist/src/modules/matrix.d.ts +2 -0
- package/dist/src/modules/number-theory.d.ts +2 -0
- package/dist/src/modules/random.d.ts +2 -0
- package/dist/src/modules/sequence.d.ts +2 -0
- package/dist/src/modules/string.d.ts +2 -0
- package/dist/src/modules/vector.d.ts +2 -0
- package/dist/src/parser/Parser.d.ts +58 -0
- package/dist/src/parser/types.d.ts +133 -0
- package/dist/src/symbolPatterns.d.ts +2 -0
- package/dist/src/tokenizer/minifyTokenStream.d.ts +4 -0
- package/dist/src/tokenizer/operators.d.ts +12 -0
- package/dist/src/tokenizer/reservedNames.d.ts +66 -0
- package/dist/src/tokenizer/token.d.ts +86 -0
- package/dist/src/tokenizer/tokenize.d.ts +8 -0
- package/dist/src/tokenizer/tokenizers.d.ts +14 -19
- package/dist/src/transformer/index.d.ts +2 -2
- package/dist/src/typeGuards/annotatedArrays.d.ts +16 -0
- package/dist/src/typeGuards/array.d.ts +1 -1
- package/dist/src/typeGuards/astNode.d.ts +20 -17
- package/dist/src/typeGuards/index.d.ts +1 -10
- package/dist/src/typeGuards/lits.d.ts +5 -2
- package/dist/src/typeGuards/litsFunction.d.ts +3 -3
- package/dist/src/typeGuards/number.d.ts +1 -1
- package/dist/src/typeGuards/string.d.ts +1 -1
- package/dist/src/untokenizer/index.d.ts +1 -1
- package/dist/src/utils/arity.d.ts +10 -0
- package/dist/src/utils/debug/debugTools.d.ts +0 -2
- package/dist/src/utils/debug/getCodeMarker.d.ts +2 -0
- package/dist/src/utils/debug/getSourceCodeInfo.d.ts +2 -2
- package/dist/src/utils/docString/generateDocString.d.ts +2 -0
- package/dist/src/utils/getAssertionError.d.ts +1 -1
- package/dist/src/utils/index.d.ts +9 -6
- package/dist/testFramework.esm.js +1 -8913
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +1 -8916
- package/dist/testFramework.js.map +1 -1
- package/package.json +88 -8
- package/dist/cli/common/clojureDocs.d.ts +0 -1
- package/dist/cli/reference/categories/array.d.ts +0 -3
- package/dist/cli/reference/categories/assert.d.ts +0 -3
- package/dist/cli/reference/categories/bitwise.d.ts +0 -3
- package/dist/cli/reference/categories/collection.d.ts +0 -3
- package/dist/cli/reference/categories/functional.d.ts +0 -3
- package/dist/cli/reference/categories/math.d.ts +0 -3
- package/dist/cli/reference/categories/misc.d.ts +0 -3
- package/dist/cli/reference/categories/object.d.ts +0 -3
- package/dist/cli/reference/categories/predicate.d.ts +0 -3
- package/dist/cli/reference/categories/regularExpression.d.ts +0 -3
- package/dist/cli/reference/categories/sequence.d.ts +0 -3
- package/dist/cli/reference/categories/specialExpressions.d.ts +0 -3
- package/dist/cli/reference/categories/string.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateAndOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateCommentOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateCondOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateDeclaredOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateDefOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateDefsOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateDoOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateFunctionOutcomes.d.ts +0 -5
- package/dist/cli/src/analyze/calculateOutcomes/calculateIfLetOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateIfNotOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateIfOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateLetOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateLoopOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateLoopsOutcomes.d.ts +0 -4
- package/dist/cli/src/analyze/calculateOutcomes/calculateOrOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateQqOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateRecurOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateThrowOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateTimeOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateTryOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateWhenFirstOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateWhenLetOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateWhenNotOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/calculateWhenOutcomes.d.ts +0 -3
- package/dist/cli/src/analyze/calculateOutcomes/index.d.ts +0 -18
- package/dist/cli/src/analyze/calculateOutcomes/specialExpressionCalculators.d.ts +0 -55
- package/dist/cli/src/analyze/findUnresolvedIdentifiers.d.ts +0 -2
- package/dist/cli/src/analyze/index.d.ts +0 -17
- package/dist/cli/src/analyze/utils.d.ts +0 -4
- package/dist/cli/src/builtin/normalExpressions/categories/assert.d.ts +0 -2
- package/dist/cli/src/builtin/normalExpressions/categories/sequence.d.ts +0 -4
- package/dist/cli/src/builtin/specialExpressions/comment.d.ts +0 -5
- package/dist/cli/src/builtin/specialExpressions/declared.d.ts +0 -5
- package/dist/cli/src/builtin/specialExpressions/defs.d.ts +0 -5
- package/dist/cli/src/builtin/specialExpressions/do.d.ts +0 -6
- package/dist/cli/src/builtin/specialExpressions/if-let.d.ts +0 -10
- package/dist/cli/src/builtin/specialExpressions/if-not.d.ts +0 -6
- package/dist/cli/src/builtin/specialExpressions/time.d.ts +0 -6
- package/dist/cli/src/builtin/specialExpressions/when-first.d.ts +0 -7
- package/dist/cli/src/builtin/specialExpressions/when-let.d.ts +0 -7
- package/dist/cli/src/builtin/specialExpressions/when-not.d.ts +0 -6
- package/dist/cli/src/builtin/specialExpressions/when.d.ts +0 -6
- package/dist/cli/src/identifier.d.ts +0 -8
- package/dist/cli/src/parser/index.d.ts +0 -3
- package/dist/cli/src/parser/interface.d.ts +0 -155
- package/dist/cli/src/parser/parsers.d.ts +0 -4
- package/dist/cli/src/removeCommentNodes/index.d.ts +0 -11
- package/dist/cli/src/removeCommentNodes/removeCommentNodesFromSpecialExpression.d.ts +0 -3
- package/dist/cli/src/reservedNames.d.ts +0 -7
- package/dist/cli/src/tokenizer/index.d.ts +0 -9
- package/dist/cli/src/tokenizer/interface.d.ts +0 -35
- package/dist/cli/src/tokenizer/sugar/applyCollectionAccessor.d.ts +0 -2
- package/dist/cli/src/tokenizer/sugar/index.d.ts +0 -3
- package/dist/cli/src/typeGuards/token.d.ts +0 -13
- package/dist/cli/src/unparser/UnparseOptions.d.ts +0 -15
- package/dist/cli/src/unparser/unparse.d.ts +0 -5
- package/dist/cli/src/unparser/unparseArrayLiteral.d.ts +0 -3
- package/dist/cli/src/unparser/unparseBindings.d.ts +0 -3
- package/dist/cli/src/unparser/unparseNormalExpression.d.ts +0 -3
- package/dist/cli/src/unparser/unparseObjectLiteral.d.ts +0 -3
- package/dist/cli/src/unparser/unparseParams.d.ts +0 -17
- package/dist/cli/src/unparser/unparseSpecialExpression/index.d.ts +0 -3
- package/dist/cli/src/unparser/unparseSpecialExpression/unparseCond.d.ts +0 -3
- package/dist/cli/src/unparser/unparseSpecialExpression/unparseDo.d.ts +0 -3
- package/dist/cli/src/unparser/unparseSpecialExpression/unparseIfLet.d.ts +0 -3
- package/dist/cli/src/unparser/unparseSpecialExpression/unparseIfOrWhenLike.d.ts +0 -6
- package/dist/cli/src/unparser/unparseSpecialExpression/unparseLet.d.ts +0 -3
- package/dist/cli/src/unparser/utils.d.ts +0 -5
- package/dist/common/clojureDocs.d.ts +0 -1
- package/dist/reference/categories/array.d.ts +0 -3
- package/dist/reference/categories/assert.d.ts +0 -3
- package/dist/reference/categories/bitwise.d.ts +0 -3
- package/dist/reference/categories/collection.d.ts +0 -3
- package/dist/reference/categories/functional.d.ts +0 -3
- package/dist/reference/categories/math.d.ts +0 -3
- package/dist/reference/categories/misc.d.ts +0 -3
- package/dist/reference/categories/object.d.ts +0 -3
- package/dist/reference/categories/predicate.d.ts +0 -3
- package/dist/reference/categories/regularExpression.d.ts +0 -3
- package/dist/reference/categories/sequence.d.ts +0 -3
- package/dist/reference/categories/specialExpressions.d.ts +0 -3
- package/dist/reference/categories/string.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateAndOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateCommentOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateCondOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateDeclaredOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateDefOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateDefsOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateDoOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateFunctionOutcomes.d.ts +0 -5
- package/dist/src/analyze/calculateOutcomes/calculateIfLetOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateIfNotOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateIfOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateLetOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateLoopOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateLoopsOutcomes.d.ts +0 -4
- package/dist/src/analyze/calculateOutcomes/calculateOrOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateQqOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateRecurOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateThrowOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateTimeOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateTryOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateWhenFirstOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateWhenLetOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateWhenNotOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/calculateWhenOutcomes.d.ts +0 -3
- package/dist/src/analyze/calculateOutcomes/index.d.ts +0 -18
- package/dist/src/analyze/calculateOutcomes/specialExpressionCalculators.d.ts +0 -55
- package/dist/src/analyze/findUnresolvedIdentifiers.d.ts +0 -2
- package/dist/src/analyze/index.d.ts +0 -17
- package/dist/src/analyze/utils.d.ts +0 -4
- package/dist/src/builtin/normalExpressions/categories/assert.d.ts +0 -2
- package/dist/src/builtin/normalExpressions/categories/sequence.d.ts +0 -4
- package/dist/src/builtin/specialExpressions/comment.d.ts +0 -5
- package/dist/src/builtin/specialExpressions/declared.d.ts +0 -5
- package/dist/src/builtin/specialExpressions/defs.d.ts +0 -5
- package/dist/src/builtin/specialExpressions/do.d.ts +0 -6
- package/dist/src/builtin/specialExpressions/if-let.d.ts +0 -10
- package/dist/src/builtin/specialExpressions/if-not.d.ts +0 -6
- package/dist/src/builtin/specialExpressions/time.d.ts +0 -6
- package/dist/src/builtin/specialExpressions/when-first.d.ts +0 -7
- package/dist/src/builtin/specialExpressions/when-let.d.ts +0 -7
- package/dist/src/builtin/specialExpressions/when-not.d.ts +0 -6
- package/dist/src/builtin/specialExpressions/when.d.ts +0 -6
- package/dist/src/identifier.d.ts +0 -8
- package/dist/src/parser/index.d.ts +0 -3
- package/dist/src/parser/interface.d.ts +0 -155
- package/dist/src/parser/parsers.d.ts +0 -4
- package/dist/src/removeCommentNodes/index.d.ts +0 -11
- package/dist/src/removeCommentNodes/removeCommentNodesFromSpecialExpression.d.ts +0 -3
- package/dist/src/reservedNames.d.ts +0 -7
- package/dist/src/tokenizer/index.d.ts +0 -9
- package/dist/src/tokenizer/interface.d.ts +0 -35
- package/dist/src/tokenizer/sugar/applyCollectionAccessor.d.ts +0 -2
- package/dist/src/tokenizer/sugar/index.d.ts +0 -3
- package/dist/src/typeGuards/token.d.ts +0 -13
- package/dist/src/unparser/UnparseOptions.d.ts +0 -15
- package/dist/src/unparser/__tests__/testFormatter.d.ts +0 -1
- package/dist/src/unparser/unparse.d.ts +0 -5
- package/dist/src/unparser/unparseArrayLiteral.d.ts +0 -3
- package/dist/src/unparser/unparseBindings.d.ts +0 -3
- package/dist/src/unparser/unparseNormalExpression.d.ts +0 -3
- package/dist/src/unparser/unparseObjectLiteral.d.ts +0 -3
- package/dist/src/unparser/unparseParams.d.ts +0 -17
- package/dist/src/unparser/unparseSpecialExpression/index.d.ts +0 -3
- package/dist/src/unparser/unparseSpecialExpression/unparseCond.d.ts +0 -3
- package/dist/src/unparser/unparseSpecialExpression/unparseDo.d.ts +0 -3
- package/dist/src/unparser/unparseSpecialExpression/unparseIfLet.d.ts +0 -3
- package/dist/src/unparser/unparseSpecialExpression/unparseIfOrWhenLike.d.ts +0 -6
- package/dist/src/unparser/unparseSpecialExpression/unparseLet.d.ts +0 -3
- package/dist/src/unparser/utils.d.ts +0 -5
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BasePrefixedNumberToken, DocStringToken, ErrorToken, LBraceToken, LBracketToken, LParenToken, MultiLineCommentToken, NumberToken, OperatorToken, RBraceToken, RBracketToken, RParenToken, RegexpShorthandToken, ReservedSymbolToken, SingleLineCommentToken, StringToken, SymbolToken, Token, TokenDescriptor, WhitespaceToken } from './token';
|
|
2
|
+
export type Tokenizer<T extends Token> = (input: string, position: number) => TokenDescriptor<T | ErrorToken>;
|
|
3
|
+
export declare const NO_MATCH: TokenDescriptor<never>;
|
|
4
|
+
export declare const tokenizeDocString: Tokenizer<DocStringToken>;
|
|
5
|
+
export declare const tokenizeWhitespace: Tokenizer<WhitespaceToken>;
|
|
6
|
+
export declare const tokenizeNumber: Tokenizer<NumberToken>;
|
|
7
|
+
export declare const tokenizeBasePrefixedNumber: Tokenizer<BasePrefixedNumberToken>;
|
|
8
|
+
export declare const tokenizeSymbol: Tokenizer<SymbolToken>;
|
|
9
|
+
export declare const tokenizeReservedSymbolToken: Tokenizer<ReservedSymbolToken>;
|
|
10
|
+
export declare const tokenizeOperator: Tokenizer<OperatorToken>;
|
|
11
|
+
export declare const tokenizeMultiLineComment: Tokenizer<MultiLineCommentToken>;
|
|
12
|
+
export declare const tokenizeShebang: Tokenizer<SingleLineCommentToken>;
|
|
13
|
+
export declare const tokenizeSingleLineComment: Tokenizer<SingleLineCommentToken>;
|
|
14
|
+
export declare const tokenizers: [Tokenizer<WhitespaceToken>, Tokenizer<MultiLineCommentToken>, Tokenizer<SingleLineCommentToken>, Tokenizer<ReservedSymbolToken>, Tokenizer<LParenToken>, Tokenizer<RParenToken>, Tokenizer<LBracketToken>, Tokenizer<RBracketToken>, Tokenizer<LBraceToken>, Tokenizer<RBraceToken>, Tokenizer<DocStringToken>, Tokenizer<StringToken>, Tokenizer<RegexpShorthandToken>, Tokenizer<BasePrefixedNumberToken>, Tokenizer<NumberToken>, Tokenizer<OperatorToken>, Tokenizer<SymbolToken>];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Any } from '../interface';
|
|
2
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
3
|
+
export declare function annotate<T>(value: T): T;
|
|
4
|
+
export declare function isVector(vector: unknown): vector is number[];
|
|
5
|
+
export declare function assertVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[];
|
|
6
|
+
export declare function is2dVector(vector: unknown): vector is [number, number];
|
|
7
|
+
export declare function assert2dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number];
|
|
8
|
+
export declare function is3dVector(vector: unknown): vector is [number, number, number];
|
|
9
|
+
export declare function assert3dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number, number];
|
|
10
|
+
export declare function assertNonEmptyVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[];
|
|
11
|
+
export declare function isGrid(grid: unknown): grid is unknown[][];
|
|
12
|
+
export declare function assertGrid(grid: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts grid is Any[][];
|
|
13
|
+
export declare function isMatrix(matrix: unknown): matrix is number[][];
|
|
14
|
+
export declare function assertMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][];
|
|
15
|
+
export declare function assertSquareMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][];
|
|
16
|
+
export declare function isSquareMatrix(matrix: unknown): matrix is number[][];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
2
|
+
export declare function asArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): unknown[];
|
|
3
|
+
export declare function assertArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is unknown[];
|
|
4
|
+
export declare function isStringArray(value: unknown): value is string[];
|
|
5
|
+
export declare function asStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[];
|
|
6
|
+
export declare function assertStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[];
|
|
7
|
+
export declare function isCharArray(value: unknown): value is string[];
|
|
8
|
+
export declare function asCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[];
|
|
9
|
+
export declare function assertCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ExpressionNode, Node, NormalBuiltinSymbolNode, NormalExpressionNode, NormalExpressionNodeWithName, SpecialBuiltinSymbolNode, SpreadNode, SymbolNode, UserDefinedSymbolNode } from '../parser/types';
|
|
2
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
3
|
+
export declare function isSymbolNode(node: Node): node is SymbolNode;
|
|
4
|
+
export declare function asSymbolNode(node: Node, sourceCodeInfo?: SourceCodeInfo): SymbolNode;
|
|
5
|
+
export declare function assertSymbolNode(node: Node, sourceCodeInfo?: SourceCodeInfo): asserts node is SymbolNode;
|
|
6
|
+
export declare function isUserDefinedSymbolNode(node: Node): node is UserDefinedSymbolNode;
|
|
7
|
+
export declare function asUserDefinedSymbolNode(node: Node, sourceCodeInfo?: SourceCodeInfo): UserDefinedSymbolNode;
|
|
8
|
+
export declare function assertUserDefinedSymbolNode(node: Node, sourceCodeInfo?: SourceCodeInfo): asserts node is UserDefinedSymbolNode;
|
|
9
|
+
export declare function isNormalBuiltinSymbolNode(node: Node): node is NormalBuiltinSymbolNode;
|
|
10
|
+
export declare function isSpecialBuiltinSymbolNode(node: Node): node is SpecialBuiltinSymbolNode;
|
|
11
|
+
export declare function isNormalExpressionNode(node: Node): node is NormalExpressionNode;
|
|
12
|
+
export declare function asNormalExpressionNode(node: Node, sourceCodeInfo?: SourceCodeInfo): NormalExpressionNode;
|
|
13
|
+
export declare function assertNormalExpressionNode(node: Node, sourceCodeInfo?: SourceCodeInfo): asserts node is NormalExpressionNode;
|
|
14
|
+
export declare function isNormalExpressionNodeWithName(node: Node): node is NormalExpressionNodeWithName;
|
|
15
|
+
export declare function asNormalExpressionNodeWithName(node: Node, sourceCodeInfo?: SourceCodeInfo): NormalExpressionNodeWithName;
|
|
16
|
+
export declare function assertNormalExpressionNodeWithName(node: Node, sourceCodeInfo?: SourceCodeInfo): asserts node is NormalExpressionNodeWithName;
|
|
17
|
+
export declare function isExpressionNode(node: Node): node is ExpressionNode;
|
|
18
|
+
export declare function asExpressionNode(node: Node, sourceCodeInfo?: SourceCodeInfo): ExpressionNode;
|
|
19
|
+
export declare function assertExpressionNode(node: Node, sourceCodeInfo?: SourceCodeInfo): asserts node is ExpressionNode;
|
|
20
|
+
export declare function isSpreadNode(node: Node): node is SpreadNode;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UnknownRecord } from '../interface';
|
|
2
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
3
|
+
export declare function isNonUndefined<T>(value: T | undefined): value is T;
|
|
4
|
+
export declare function asNonUndefined<T>(value: T | undefined, sourceCodeInfo?: SourceCodeInfo): T;
|
|
5
|
+
export declare function assertNonUndefined<T>(value: T | undefined, sourceCodeInfo?: SourceCodeInfo): asserts value is T;
|
|
6
|
+
export declare function isUnknownRecord(value: unknown): value is Record<string, unknown>;
|
|
7
|
+
export declare function assertUnknownRecord(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is UnknownRecord;
|
|
8
|
+
export declare function asUnknownRecord(value: unknown, sourceCodeInfo?: SourceCodeInfo): UnknownRecord;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Any, Coll, Obj, Seq } from '../interface';
|
|
2
|
+
import type { FunctionLike, RegularExpression } from '../parser/types';
|
|
3
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
4
|
+
export declare function isAny(value: unknown): value is Any;
|
|
5
|
+
export declare function asAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): Any;
|
|
6
|
+
export declare function assertAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Any;
|
|
7
|
+
export declare function isSeq(value: unknown): value is Seq;
|
|
8
|
+
export declare function asSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): Seq;
|
|
9
|
+
export declare function assertSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Seq;
|
|
10
|
+
export declare function isObj(value: unknown): value is Obj;
|
|
11
|
+
export declare function asObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): Obj;
|
|
12
|
+
export declare function assertObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Obj;
|
|
13
|
+
export declare function isColl(value: unknown): value is Coll;
|
|
14
|
+
export declare function asColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): Coll;
|
|
15
|
+
export declare function assertColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Coll;
|
|
16
|
+
export declare function isRegularExpression(regexp: unknown): regexp is RegularExpression;
|
|
17
|
+
export declare function asRegularExpression(value: unknown, sourceCodeInfo?: SourceCodeInfo): RegularExpression;
|
|
18
|
+
export declare function assertRegularExpression(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is RegularExpression;
|
|
19
|
+
export declare function isStringOrRegularExpression(value: unknown): value is string | RegularExpression;
|
|
20
|
+
export declare function asStringOrRegularExpression(value: unknown, sourceCodeInfo?: SourceCodeInfo): string | RegularExpression;
|
|
21
|
+
export declare function assertStringOrRegularExpression(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string | RegularExpression;
|
|
22
|
+
export declare function isFunctionLike(value: unknown): value is FunctionLike;
|
|
23
|
+
export declare function asFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): FunctionLike;
|
|
24
|
+
export declare function assertFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is FunctionLike;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LitsFunction, NativeJsFunction, NormalBuiltinFunction, UserDefinedFunction } from '../parser/types';
|
|
2
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
3
|
+
export declare function isLitsFunction(value: unknown): value is LitsFunction;
|
|
4
|
+
export declare function asLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsFunction;
|
|
5
|
+
export declare function assertLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is LitsFunction;
|
|
6
|
+
export declare function isUserDefinedFunction(value: unknown): value is UserDefinedFunction;
|
|
7
|
+
export declare function asUserDefinedFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): UserDefinedFunction;
|
|
8
|
+
export declare function assertUserDefinedFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is UserDefinedFunction;
|
|
9
|
+
export declare function isNativeJsFunction(value: unknown): value is NativeJsFunction;
|
|
10
|
+
export declare function asNativeJsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): NativeJsFunction;
|
|
11
|
+
export declare function assertNativeJsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is NativeJsFunction;
|
|
12
|
+
export declare function isBuiltinFunction(value: unknown): value is NormalBuiltinFunction;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
2
|
+
type SignOptions = {
|
|
3
|
+
positive?: true;
|
|
4
|
+
negative?: never;
|
|
5
|
+
nonPositive?: never;
|
|
6
|
+
nonNegative?: never;
|
|
7
|
+
zero?: never;
|
|
8
|
+
nonZero?: never;
|
|
9
|
+
} | {
|
|
10
|
+
positive?: never;
|
|
11
|
+
negative?: true;
|
|
12
|
+
nonPositive?: never;
|
|
13
|
+
nonNegative?: never;
|
|
14
|
+
zero?: never;
|
|
15
|
+
nonZero?: never;
|
|
16
|
+
} | {
|
|
17
|
+
positive?: never;
|
|
18
|
+
negative?: never;
|
|
19
|
+
nonPositive?: true;
|
|
20
|
+
nonNegative?: never;
|
|
21
|
+
zero?: never;
|
|
22
|
+
nonZero?: never;
|
|
23
|
+
} | {
|
|
24
|
+
positive?: never;
|
|
25
|
+
negative?: never;
|
|
26
|
+
nonPositive?: never;
|
|
27
|
+
nonNegative?: true;
|
|
28
|
+
zero?: never;
|
|
29
|
+
nonZero?: never;
|
|
30
|
+
} | {
|
|
31
|
+
positive?: never;
|
|
32
|
+
negative?: never;
|
|
33
|
+
nonPositive?: never;
|
|
34
|
+
nonNegative?: never;
|
|
35
|
+
zero?: true;
|
|
36
|
+
nonZero?: never;
|
|
37
|
+
} | {
|
|
38
|
+
positive?: never;
|
|
39
|
+
negative?: never;
|
|
40
|
+
nonPositive?: never;
|
|
41
|
+
nonNegative?: never;
|
|
42
|
+
zero?: never;
|
|
43
|
+
nonZero?: true;
|
|
44
|
+
};
|
|
45
|
+
type GtOptions = {
|
|
46
|
+
gt?: number;
|
|
47
|
+
gte?: never;
|
|
48
|
+
} | {
|
|
49
|
+
gt?: never;
|
|
50
|
+
gte?: number;
|
|
51
|
+
};
|
|
52
|
+
type LtOptions = {
|
|
53
|
+
lt?: number;
|
|
54
|
+
lte?: never;
|
|
55
|
+
} | {
|
|
56
|
+
lt?: never;
|
|
57
|
+
lte?: number;
|
|
58
|
+
};
|
|
59
|
+
type NumberOptions = {
|
|
60
|
+
integer?: true;
|
|
61
|
+
finite?: true;
|
|
62
|
+
} & SignOptions & GtOptions & LtOptions;
|
|
63
|
+
export declare function isNumber(value: unknown, options?: NumberOptions): value is number;
|
|
64
|
+
export declare function assertNumber(value: unknown, sourceCodeInfo?: SourceCodeInfo, options?: NumberOptions): asserts value is number;
|
|
65
|
+
export declare function asNumber(value: unknown, sourceCodeInfo: SourceCodeInfo | undefined, options?: NumberOptions): number;
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
2
|
+
type StringAssertionOptions = {
|
|
3
|
+
nonEmpty?: true;
|
|
4
|
+
char?: never;
|
|
5
|
+
} | {
|
|
6
|
+
nonEmpty?: never;
|
|
7
|
+
char?: true;
|
|
8
|
+
};
|
|
9
|
+
export declare function isString(value: unknown, options?: StringAssertionOptions): value is string;
|
|
10
|
+
export declare function assertString(value: unknown, sourceCodeInfo: SourceCodeInfo | undefined, options?: StringAssertionOptions): asserts value is string;
|
|
11
|
+
export declare function asString(value: unknown, sourceCodeInfo: SourceCodeInfo | undefined, options?: StringAssertionOptions): string;
|
|
12
|
+
export declare function isStringOrNumber(value: unknown): value is string | number;
|
|
13
|
+
export declare function asStringOrNumber(value: unknown, sourceCodeInfo?: SourceCodeInfo): string | number;
|
|
14
|
+
export declare function assertStringOrNumber(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string | number;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Arity } from '../builtin/interface';
|
|
2
|
+
import type { FunctionLike } from '../parser/types';
|
|
3
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
4
|
+
export declare function arityAccepts(arity: Arity, nbrOfParams: number): boolean;
|
|
5
|
+
export declare function arityAcceptsMin(arity: Arity, nbrOfParams: number): boolean;
|
|
6
|
+
export declare function getCommonArityFromFunctions(params: FunctionLike[]): Arity | null;
|
|
7
|
+
export declare function getArityFromFunction(param: FunctionLike): Arity;
|
|
8
|
+
export declare function assertNumberOfParams(arity: Arity, length: number, sourceCodeInfo: SourceCodeInfo | undefined): void;
|
|
9
|
+
export declare function canBeOperator(count: Arity): boolean;
|
|
10
|
+
export declare function toFixedArity(arity: number): Arity;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function valueToString(value: unknown): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Any, Coll } from '../interface';
|
|
2
|
+
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
3
|
+
export declare function collHasKey(coll: unknown, key: string | number): boolean;
|
|
4
|
+
export declare function compare<T extends string | number>(a: T, b: T, sourceCodeInfo: SourceCodeInfo | undefined): number;
|
|
5
|
+
export declare function deepEqual(a: unknown, b: unknown, sourceCodeInfo?: SourceCodeInfo): boolean;
|
|
6
|
+
export declare function toNonNegativeInteger(num: number): number;
|
|
7
|
+
export declare function toAny(value: unknown): Any;
|
|
8
|
+
export declare function cloneColl<T extends Coll>(value: T): T;
|
|
9
|
+
export declare function joinSets<T>(...results: Set<T>[]): Set<T>;
|
|
10
|
+
export declare function addToSet<T>(target: Set<T>, source: Set<T>): void;
|
|
11
|
+
export declare const EPSILON = 1e-10;
|
|
12
|
+
export declare function approxEqual(a: number, b: number, epsilon?: number): boolean;
|
|
13
|
+
export declare function approxZero(value: number): boolean;
|
|
14
|
+
export declare function smartTrim(str: string, minIndent?: number): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function t(t){if(!t.position||!t.code)return"";const e=t.position.column-1,r=t.code.length-e-1;return`${" ".repeat(Math.max(e,0))}^${" ".repeat(Math.max(r,0))}`}class e extends Error{sourceCodeInfo;shortMessage;constructor(r,n){const i=r instanceof Error?r.message:`${r}`;super(function(e,r){if(!r)return e;const n=`${r.position.line}:${r.position.column}`;return`${e}${r.filePath?`\n${r.filePath}:${n}`:`\nLocation ${n}`}\n${r.code}\n${t(r)}`}(i,n)),this.shortMessage=i,this.sourceCodeInfo=n,Object.setPrototypeOf(this,e.prototype),this.name="LitsError"}getCodeMarker(){return this.sourceCodeInfo&&t(this.sourceCodeInfo)}}const r={Number:1,String:2,NormalExpression:3,SpecialExpression:4,UserDefinedSymbol:5,NormalBuiltinSymbol:6,SpecialBuiltinSymbol:7,ReservedSymbol:8,Binding:9,Spread:10},n=new Set(Object.values(r));const i=new Set(["UserDefined","Partial","Comp","Constantly","Juxt","Complement","EveryPred","SomePred","Fnull","Builtin","SpecialBuiltin","NativeJsFunction","Module"]);function o(t){return null!==t&&"object"==typeof t&&("^^fn^^"in t&&"functionType"in t&&("string"==typeof(e=t.functionType)&&i.has(e)));var e}function s(t){return!(!Array.isArray(t)||t.length<2)&&("number"==typeof(e=t[0])&&n.has(e));var e}function a(t){return o(t)?`<function ${t.name||"λ"}>`:s(t)?`${e=t[0],Object.keys(r).find(t=>r[t]===e)}-node`:null===t?"null":"object"==typeof t&&t instanceof RegExp?`${t}`:"object"==typeof t&&t instanceof Error?t.toString():JSON.stringify(t);var e}function p(t,e){return t?.sourceCodeInfo??e}function l(t,r){return function(t,r){if(!function(t){return void 0!==t}(t))throw new e("Unexpected undefined",p(t,r))}(t,r),t}function g(t,r,n){return new e(`Expected ${t}, got ${a(r)}.`,p(r,n))}function m(t,r,n={}){if(!function(t,e={}){return!("number"!=typeof t||Number.isNaN(t)||e.integer&&!Number.isInteger(t)||e.finite&&!Number.isFinite(t)||e.zero&&0!==t||e.nonZero&&0===t||e.positive&&t<=0||e.negative&&t>=0||e.nonPositive&&t>0||e.nonNegative&&t<0||"number"==typeof e.gt&&t<=e.gt||"number"==typeof e.gte&&t<e.gte||"number"==typeof e.lt&&t>=e.lt||"number"==typeof e.lte&&t>e.lte)}(t,n))throw new e(`Expected ${function(t){if(t.zero)return"zero";const e=function(t){return t.positive?"positive":t.negative?"negative":t.nonNegative?"non negative":t.nonPositive?"non positive":t.nonZero?"non zero":""}(t),r=t.integer?"integer":"number",n=t.finite?"finite":"",i=function(t){return"number"!=typeof t.gt&&"number"!=typeof t.gte||"number"!=typeof t.lt&&"number"!=typeof t.lte?"number"==typeof t.gt||"number"==typeof t.gte?"number"==typeof t.gt?`n > ${t.gt}`:`n >= ${t.gte}`:"number"==typeof t.lt||"number"==typeof t.lte?"number"==typeof t.lt?`n < ${t.lt}`:`n <= ${t.lte}`:"":`${"number"==typeof t.gt?`${t.gt} < n `:`${t.gte} <= n `}${"number"==typeof t.lt?`< ${t.lt}`:`<= ${t.lte}`}`}(t);return[e,n,r,i].filter(t=>!!t).join(" ")}(n)}, got ${a(t)}.`,p(t,r))}function c(t,e,r={}){if(!function(t,e={}){return!("string"!=typeof t||e.nonEmpty&&0===t.length||e.char&&1!==t.length)}(t,r))throw g(""+(r.nonEmpty?"non empty string":r.char?"character":"string"),t,e)}function u(t,e){return function(t,e){if(!function(t){return"string"==typeof t||"number"==typeof t}(t))throw g("string or number",t,e)}(t,e),t}function d(t){return{min:t,max:t}}const f={"string-repeat":{evaluate:([t,e],r)=>(c(t,r),m(e,r,{integer:!0,nonNegative:!0}),t.repeat(e)),arity:d(2),docs:{category:"string",returns:{type:"number"},args:{a:{type:"string"},b:{type:"integer"},s:{type:"string"},n:{type:"integer"}},variants:[{argumentNames:["s","n"]}],description:"Repeates $s $n times.",seeAlso:["str","repeat"],examples:['let { string-repeat } = import("string"); "*" string-repeat 10','let { string-repeat } = import("string"); string-repeat("*", 10)','let { string-repeat } = import("string"); string-repeat("***", 0)']}},"from-char-code":{evaluate:([t],r)=>{m(t,r,{finite:!0});const n=function(t){return Math.max(0,Math.ceil(t))}(t);try{return String.fromCodePoint(n)}catch(t){throw new e(t,r)}},arity:d(1),docs:{category:"string",returns:{type:"string"},args:{code:{type:"number"}},variants:[{argumentNames:["code"]}],description:"Return character for code point $code.",seeAlso:["string.to-char-code"],examples:['let { from-char-code } = import("string"); from-char-code(65)','let { from-char-code } = import("string"); from-char-code(0)']}},"to-char-code":{evaluate:([t],e)=>(c(t,e,{nonEmpty:!0}),l(t.codePointAt(0),e)),arity:d(1),docs:{category:"string",returns:{type:"number"},args:{c:{type:"string"}},variants:[{argumentNames:["c"]}],description:"Return code point for first character in $c.",seeAlso:["string.from-char-code"],examples:['let { to-char-code } = import("string"); to-char-code("A")','let { to-char-code } = import("string"); to-char-code("Albert")']}},"trim-left":{evaluate:([t],e)=>(c(t,e),t.replace(/^\s+/,"")),arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Returns a new string with leading whitespaces removed.",seeAlso:["trim","string.trim-right"],examples:['let { trim-left } = import("string"); trim-left(" Albert ")','let { trim-left } = import("string"); trim-left(" ")','let { trim-left } = import("string"); trim-left("")']}},"trim-right":{evaluate:([t],e)=>(c(t,e),t.replace(/\s+$/,"")),arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Returns a new string with trailing whitespaces removed.",seeAlso:["trim","string.trim-left"],examples:['let { trim-right } = import("string"); trim-right(" Albert ")','let { trim-right } = import("string"); trim-right(" ")','let { trim-right } = import("string"); trim-right("")']}},"split-lines":{evaluate:([t],e)=>(c(t,e),t.split(/\r\n|\n|\r/).filter(t=>""!==t)),arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Divides $s into an array of substrings, each representing a line.",seeAlso:["split"],examples:['let { split-lines } = import("string"); split-lines("Albert\nMojir\n")','let { split-lines } = import("string"); split-lines("Albert\n\nMojir")','let { split-lines } = import("string"); split-lines("Albert\nMojir\n\n")','let { split-lines } = import("string"); split-lines("")']}},"pad-left":{evaluate:([t,e,r],n)=>(c(t,n),m(e,n,{integer:!0}),void 0!==r&&c(r,n),t.padStart(e,r)),arity:{min:2,max:3},docs:{category:"string",returns:{type:"string"},args:{a:{type:"string"},b:{type:"integer"},s:{type:"string"},length:{type:"integer"},padString:{type:"string"}},variants:[{argumentNames:["s","length"]},{argumentNames:["s","length","padString"]}],description:"Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given $length.",seeAlso:["string.pad-right"],examples:['let { pad-left } = import("string"); "Albert" pad-left 20','let { pad-left } = import("string"); pad-left("Albert", 20)','let { pad-left } = import("string"); pad-left("Albert", 20, "-*-")','let { pad-left } = import("string"); pad-left("Albert", 5)','let { pad-left } = import("string"); pad-left("Albert", -1)']}},"pad-right":{evaluate:([t,e,r],n)=>(c(t,n),m(e,n,{integer:!0}),void 0!==r&&c(r,n),t.padEnd(e,r)),arity:{min:2,max:3},docs:{category:"string",returns:{type:"string"},args:{a:{type:"string"},b:{type:"integer"},s:{type:"string"},length:{type:"integer"},padString:{type:"string"}},variants:[{argumentNames:["s","length"]},{argumentNames:["s","length","padString"]}],description:"Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given `length`.",seeAlso:["string.pad-left"],examples:['let { pad-right } = import("string"); "Albert" pad-right 20','let { pad-right } = import("string"); pad-right("Albert", 20)','let { pad-right } = import("string"); pad-right("Albert", 20, "-*-")','let { pad-right } = import("string"); pad-right("Albert", 5)','let { pad-right } = import("string"); pad-right("Albert", -1)']}},template:{evaluate:([t,...e],r)=>{c(t,r),function(t,e){if(!Array.isArray(t))throw g("array",t,e)}(e,r);const n=t.split("||||");if(n.length<=1)return b(n[0],e,r);{const t=e[0];m(t,r,{integer:!0,nonNegative:!0});const i=[`${t}`,...e.slice(1)];if(2===n.length){return b(n[1===t?0:1],i,r)}return b(n[Math.min(t,n.length-1)],i,r)}},arity:{min:1,max:10},docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"},params:{type:"any",rest:!0}},variants:[{argumentNames:["s","params"]}],description:"Applies placeholders to a string. Support for basic pluralization - see examples. If pluralization is used, first placeholder must be a number.",seeAlso:["str"],examples:['let { template } = import("string"); template("Hi, $1 and $2", "Carl", "Larry")','let { template } = import("string"); template("Hi $1, $2, $3, $4, $5, $6, $7, $8 and $9", "A", "B", "C", "D", "E", "F", "G", "H", "I")','let { template } = import("string"); template("$1 book||||$1 books", 0)','let { template } = import("string"); template("$1 book||||$1 books", 1)','let { template } = import("string"); template("$1 book||||$1 books", 2)','let { template } = import("string"); template("No book||||$1 book||||$1 books", 0)','let { template } = import("string"); template("No book||||$1 book||||$1 books", 1)','let { template } = import("string"); template("No book||||$1 book||||$1 books", 10)','let { template } = import("string"); template("No book||||One book||||Two books||||Three books||||$1 books", 0)','let { template } = import("string"); template("No book||||One book||||Two books||||Three books||||$1 books", 1)','let { template } = import("string"); template("No book||||One book||||Two books||||Three books||||$1 books", 2)','let { template } = import("string"); template("No book||||One book||||Two books||||Three books||||$1 books", 3)','let { template } = import("string"); template("No book||||One book||||Two books||||Three books||||$1 books", 4)'],hideOperatorForm:!0}},"encode-base64":{evaluate:([t],e)=>(c(t,e),btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(Number.parseInt(e,16))))),arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Returns a Base64 encoded string from $s.",seeAlso:["string.decode-base64"],examples:['let { encode-base64 } = import("string"); encode-base64("Albert")']}},"decode-base64":{evaluate:([t],r)=>{c(t,r);try{return decodeURIComponent(Array.prototype.map.call(atob(t),t=>`%${`00${t.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}catch(t){throw new e(t,r)}},arity:d(1),docs:{category:"string",returns:{type:"string"},args:{base64string:{type:"string"}},variants:[{argumentNames:["base64string"]}],description:"Returns a Base64 decoded string from $base64string.",seeAlso:["string.encode-base64"],examples:['let { decode-base64 } = import("string"); decode-base64("QWxiZXJ0IPCfkLs=")']}},"encode-uri-component":{evaluate:([t],e)=>(c(t,e),encodeURIComponent(t)),arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Returns an escaped `URI` string.",seeAlso:["string.decode-uri-component"],examples:['let { encode-uri-component } = import("string"); encode-uri-component("Hi everyone!?")']}},"decode-uri-component":{evaluate:([t],r)=>{c(t,r);try{return decodeURIComponent(t)}catch(t){throw new e(t,r)}},arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Returns an un-escaped `URI` string.",seeAlso:["string.encode-uri-component"],examples:['let { decode-uri-component } = import("string"); decode-uri-component("Hi%20everyone!%3F%20%F0%9F%91%8D")']}},capitalize:{evaluate:([t],e)=>(c(t,e),t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()),arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Returns $s with the first character converted to uppercase and the rest to lowercase.",seeAlso:["lower-case","upper-case"],examples:['let { capitalize } = import("string"); capitalize("albert")','let { capitalize } = import("string"); capitalize("ALBERT")','let { capitalize } = import("string"); capitalize("aLBERT")','let { capitalize } = import("string"); capitalize("")']}}},y=/\$\$/g;function b(t,e,r){for(let n=0;n<9;n+=1){const i=new RegExp(`(\\$\\$|[^$]|^)\\$${n+1}`,"g");if(i.test(t)){const o=u(e[n],r);t=t.replace(i,`$1${o}`)}}return t=t.replace(y,"$")}const h={name:"string",functions:f};export{h as stringUtilsModule};
|
|
2
|
+
//# sourceMappingURL=string.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.esm.js","sources":["../../src/utils/debug/getCodeMarker.ts","../../src/errors.ts","../../src/constants/constants.ts","../../src/utils/debug/debugTools.ts","../../src/utils/symbols.ts","../../src/utils/debug/getSourceCodeInfo.ts","../../src/typeGuards/index.ts","../../src/utils/getAssertionError.ts","../../src/typeGuards/number.ts","../../src/typeGuards/string.ts","../../src/utils/arity.ts","../../src/builtin/modules/string/index.ts","../../src/utils/index.ts","../../src/typeGuards/array.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","import { getNodeTypeName, isFunctionType, isNodeType } from '../../constants/constants'\nimport type { LitsFunction, Node } 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 Node {\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","export const FUNCTION_SYMBOL = '^^fn^^'\nexport const REGEXP_SYMBOL = '^^re^^'\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 { UnknownRecord } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\nexport function isNonUndefined<T>(value: T | undefined): value is T {\n return value !== undefined\n}\n\nexport function asNonUndefined<T>(value: T | undefined, sourceCodeInfo?: SourceCodeInfo): T {\n assertNonUndefined(value, sourceCodeInfo)\n return value\n}\n\nexport function assertNonUndefined<T>(value: T | undefined, sourceCodeInfo?: SourceCodeInfo): asserts value is T {\n if (!isNonUndefined(value))\n throw new LitsError('Unexpected undefined', getSourceCodeInfo(value, sourceCodeInfo))\n}\n\nexport function isUnknownRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n\nexport function assertUnknownRecord(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is UnknownRecord {\n if (!isUnknownRecord(value)) {\n throw new LitsError(\n `Expected ${'UnknownRecord'}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asUnknownRecord(value: unknown, sourceCodeInfo?: SourceCodeInfo): UnknownRecord {\n assertUnknownRecord(value, sourceCodeInfo)\n return value\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 { 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 { 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 { LitsError } from '../../../errors'\nimport { asNonUndefined } from '../../../typeGuards'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { asStringOrNumber, assertString } from '../../../typeGuards/string'\nimport { toNonNegativeInteger } from '../../../utils'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../interface'\nimport type { LitsModule } from '../interface'\nimport type { SourceCodeInfo } from '../../../tokenizer/token'\n\nconst stringUtilsFunctions: BuiltinNormalExpressions = {\n 'string-repeat': {\n evaluate: ([str, count], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n\n return str.repeat(count)\n },\n arity: toFixedArity(2),\n docs: {\n category: 'string',\n returns: { type: 'number' },\n args: {\n a: { type: 'string' },\n b: { type: 'integer' },\n s: { type: 'string' },\n n: { type: 'integer' },\n },\n variants: [{ argumentNames: ['s', 'n'] }],\n description: 'Repeates $s $n times.',\n seeAlso: ['str', 'repeat'],\n examples: [\n 'let { string-repeat } = import(\"string\"); \"*\" string-repeat 10',\n 'let { string-repeat } = import(\"string\"); string-repeat(\"*\", 10)',\n 'let { string-repeat } = import(\"string\"); string-repeat(\"***\", 0)',\n ],\n },\n },\n\n 'from-char-code': {\n evaluate: ([num], sourceCodeInfo): string => {\n assertNumber(num, sourceCodeInfo, { finite: true })\n const int = toNonNegativeInteger(num)\n try {\n return String.fromCodePoint(int)\n }\n catch (error) {\n throw new LitsError(error as Error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { code: { type: 'number' } },\n variants: [{ argumentNames: ['code'] }],\n description: 'Return character for code point $code.',\n seeAlso: ['string.to-char-code'],\n examples: [\n 'let { from-char-code } = import(\"string\"); from-char-code(65)',\n 'let { from-char-code } = import(\"string\"); from-char-code(0)',\n ],\n },\n },\n\n 'to-char-code': {\n evaluate: ([str], sourceCodeInfo): number => {\n assertString(str, sourceCodeInfo, { nonEmpty: true })\n return asNonUndefined(str.codePointAt(0), sourceCodeInfo)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'number' },\n args: { c: { type: 'string' } },\n variants: [{ argumentNames: ['c'] }],\n description: 'Return code point for first character in $c.',\n seeAlso: ['string.from-char-code'],\n examples: [\n 'let { to-char-code } = import(\"string\"); to-char-code(\"A\")',\n 'let { to-char-code } = import(\"string\"); to-char-code(\"Albert\")',\n ],\n },\n },\n\n 'trim-left': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.replace(/^\\s+/, '')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns a new string with leading whitespaces removed.',\n seeAlso: ['trim', 'string.trim-right'],\n examples: [\n 'let { trim-left } = import(\"string\"); trim-left(\" Albert \")',\n 'let { trim-left } = import(\"string\"); trim-left(\" \")',\n 'let { trim-left } = import(\"string\"); trim-left(\"\")',\n ],\n },\n },\n\n 'trim-right': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.replace(/\\s+$/, '')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns a new string with trailing whitespaces removed.',\n seeAlso: ['trim', 'string.trim-left'],\n examples: [\n 'let { trim-right } = import(\"string\"); trim-right(\" Albert \")',\n 'let { trim-right } = import(\"string\"); trim-right(\" \")',\n 'let { trim-right } = import(\"string\"); trim-right(\"\")',\n ],\n },\n },\n\n 'split-lines': {\n evaluate: ([str], sourceCodeInfo): string[] => {\n assertString(str, sourceCodeInfo)\n return str.split((/\\r\\n|\\n|\\r/)).filter(line => line !== '')\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Divides $s into an array of substrings, each representing a line.',\n seeAlso: ['split'],\n examples: [\n 'let { split-lines } = import(\"string\"); split-lines(\"Albert\\nMojir\\n\")',\n 'let { split-lines } = import(\"string\"); split-lines(\"Albert\\n\\nMojir\")',\n 'let { split-lines } = import(\"string\"); split-lines(\"Albert\\nMojir\\n\\n\")',\n 'let { split-lines } = import(\"string\"); split-lines(\"\")',\n ],\n },\n },\n\n 'pad-left': {\n evaluate: ([str, length, padString], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertNumber(length, sourceCodeInfo, { integer: true })\n\n if (padString !== undefined)\n assertString(padString, sourceCodeInfo)\n\n return str.padStart(length, padString)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: {\n a: { type: 'string' },\n b: { type: 'integer' },\n s: { type: 'string' },\n length: { type: 'integer' },\n padString: { type: 'string' },\n },\n variants: [\n { argumentNames: ['s', 'length'] },\n { argumentNames: ['s', 'length', 'padString'] },\n ],\n description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given $length.',\n seeAlso: ['string.pad-right'],\n examples: [\n 'let { pad-left } = import(\"string\"); \"Albert\" pad-left 20',\n 'let { pad-left } = import(\"string\"); pad-left(\"Albert\", 20)',\n 'let { pad-left } = import(\"string\"); pad-left(\"Albert\", 20, \"-*-\")',\n 'let { pad-left } = import(\"string\"); pad-left(\"Albert\", 5)',\n 'let { pad-left } = import(\"string\"); pad-left(\"Albert\", -1)',\n ],\n },\n },\n\n 'pad-right': {\n evaluate: ([str, length, padString], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n assertNumber(length, sourceCodeInfo, { integer: true })\n\n if (padString !== undefined)\n assertString(padString, sourceCodeInfo)\n\n return str.padEnd(length, padString)\n },\n arity: { min: 2, max: 3 },\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: {\n a: { type: 'string' },\n b: { type: 'integer' },\n s: { type: 'string' },\n length: { type: 'integer' },\n padString: { type: 'string' },\n },\n variants: [\n { argumentNames: ['s', 'length'] },\n { argumentNames: ['s', 'length', 'padString'] },\n ],\n description: 'Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given `length`.',\n seeAlso: ['string.pad-left'],\n examples: [\n 'let { pad-right } = import(\"string\"); \"Albert\" pad-right 20',\n 'let { pad-right } = import(\"string\"); pad-right(\"Albert\", 20)',\n 'let { pad-right } = import(\"string\"); pad-right(\"Albert\", 20, \"-*-\")',\n 'let { pad-right } = import(\"string\"); pad-right(\"Albert\", 5)',\n 'let { pad-right } = import(\"string\"); pad-right(\"Albert\", -1)',\n ],\n },\n },\n\n 'template': {\n evaluate: ([templateString, ...placeholders], sourceCodeInfo): string => {\n assertString(templateString, sourceCodeInfo)\n assertArray(placeholders, sourceCodeInfo)\n const templateStrings = templateString.split('||||')\n if (templateStrings.length <= 1) {\n return applyPlaceholders(templateStrings[0] as string, placeholders, sourceCodeInfo)\n }\n else {\n // Pluralisation\n const count = placeholders[0]\n assertNumber(count, sourceCodeInfo, { integer: true, nonNegative: true })\n const stringPlaceholders = [`${count}`, ...placeholders.slice(1)] as string[]\n if (templateStrings.length === 2) {\n // Exactly two valiants.\n // First variant (singular) for count = 1, Second variant (plural) for count = 0 or count > 1\n\n const placehoder = templateStrings[count === 1 ? 0 : 1] as string\n return applyPlaceholders(placehoder, stringPlaceholders, sourceCodeInfo)\n }\n else {\n // More than two variant:\n // Use count as index\n // If count >= number of variants, use last variant\n\n const placehoder = templateStrings[Math.min(count, templateStrings.length - 1)] as string\n return applyPlaceholders(placehoder, stringPlaceholders, sourceCodeInfo)\n }\n }\n },\n arity: { min: 1, max: 10 },\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: {\n s: { type: 'string' },\n params: { type: 'any', rest: true },\n },\n variants: [{ argumentNames: ['s', 'params'] }],\n description: 'Applies placeholders to a string. Support for basic pluralization - see examples. If pluralization is used, first placeholder must be a number.',\n seeAlso: ['str'],\n examples: [\n 'let { template } = import(\"string\"); template(\"Hi, $1 and $2\", \"Carl\", \"Larry\")',\n 'let { template } = import(\"string\"); template(\"Hi $1, $2, $3, $4, $5, $6, $7, $8 and $9\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\")',\n 'let { template } = import(\"string\"); template(\"$1 book||||$1 books\", 0)',\n 'let { template } = import(\"string\"); template(\"$1 book||||$1 books\", 1)',\n 'let { template } = import(\"string\"); template(\"$1 book||||$1 books\", 2)',\n 'let { template } = import(\"string\"); template(\"No book||||$1 book||||$1 books\", 0)',\n 'let { template } = import(\"string\"); template(\"No book||||$1 book||||$1 books\", 1)',\n 'let { template } = import(\"string\"); template(\"No book||||$1 book||||$1 books\", 10)',\n 'let { template } = import(\"string\"); template(\"No book||||One book||||Two books||||Three books||||$1 books\", 0)',\n 'let { template } = import(\"string\"); template(\"No book||||One book||||Two books||||Three books||||$1 books\", 1)',\n 'let { template } = import(\"string\"); template(\"No book||||One book||||Two books||||Three books||||$1 books\", 2)',\n 'let { template } = import(\"string\"); template(\"No book||||One book||||Two books||||Three books||||$1 books\", 3)',\n 'let { template } = import(\"string\"); template(\"No book||||One book||||Two books||||Three books||||$1 books\", 4)',\n ],\n hideOperatorForm: true,\n },\n },\n\n 'encode-base64': {\n evaluate: ([value], sourceCodeInfo): string => {\n assertString(value, sourceCodeInfo)\n return btoa(\n encodeURIComponent(value).replace(/%([0-9A-F]{2})/g, (_match, p1) => {\n // eslint-disable-next-line ts/no-unsafe-argument\n return String.fromCharCode(Number.parseInt(p1, 16))\n }),\n )\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns a Base64 encoded string from $s.',\n seeAlso: ['string.decode-base64'],\n examples: [\n 'let { encode-base64 } = import(\"string\"); encode-base64(\"Albert\")',\n ],\n },\n },\n\n 'decode-base64': {\n evaluate: ([value], sourceCodeInfo): string => {\n assertString(value, sourceCodeInfo)\n try {\n return decodeURIComponent(\n Array.prototype.map\n .call(atob(value), (c) => {\n // eslint-disable-next-line ts/no-unsafe-call, ts/no-unsafe-member-access\n return `%${(`00${c.charCodeAt(0).toString(16)}`).slice(-2)}`\n })\n .join(''),\n )\n }\n catch (error) {\n throw new LitsError(error as Error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { base64string: { type: 'string' } },\n variants: [{ argumentNames: ['base64string'] }],\n description: 'Returns a Base64 decoded string from $base64string.',\n seeAlso: ['string.encode-base64'],\n examples: [\n 'let { decode-base64 } = import(\"string\"); decode-base64(\"QWxiZXJ0IPCfkLs=\")',\n ],\n },\n },\n\n 'encode-uri-component': {\n evaluate: ([value], sourceCodeInfo): string => {\n assertString(value, sourceCodeInfo)\n return encodeURIComponent(value)\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns an escaped `URI` string.',\n seeAlso: ['string.decode-uri-component'],\n examples: [\n 'let { encode-uri-component } = import(\"string\"); encode-uri-component(\"Hi everyone!?\")',\n ],\n },\n },\n\n 'decode-uri-component': {\n evaluate: ([value], sourceCodeInfo): string => {\n assertString(value, sourceCodeInfo)\n try {\n return decodeURIComponent(value)\n }\n catch (error) {\n throw new LitsError(error as Error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns an un-escaped `URI` string.',\n seeAlso: ['string.encode-uri-component'],\n examples: [\n 'let { decode-uri-component } = import(\"string\"); decode-uri-component(\"Hi%20everyone!%3F%20%F0%9F%91%8D\")',\n ],\n },\n },\n\n 'capitalize': {\n evaluate: ([str], sourceCodeInfo): string => {\n assertString(str, sourceCodeInfo)\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()\n },\n arity: toFixedArity(1),\n docs: {\n category: 'string',\n returns: { type: 'string' },\n args: { s: { type: 'string' } },\n variants: [{ argumentNames: ['s'] }],\n description: 'Returns $s with the first character converted to uppercase and the rest to lowercase.',\n seeAlso: ['lower-case', 'upper-case'],\n examples: [\n 'let { capitalize } = import(\"string\"); capitalize(\"albert\")',\n 'let { capitalize } = import(\"string\"); capitalize(\"ALBERT\")',\n 'let { capitalize } = import(\"string\"); capitalize(\"aLBERT\")',\n 'let { capitalize } = import(\"string\"); capitalize(\"\")',\n ],\n },\n },\n}\n\nconst doubleDollarRegexp = /\\$\\$/g\nfunction applyPlaceholders(templateString: string, placeholders: unknown[], sourceCodeInfo?: SourceCodeInfo): string {\n for (let i = 0; i < 9; i += 1) {\n // Matches $1, $2, ..., $9\n // Does not match $$1\n // But does match $$$1, (since the two first '$' will later be raplaced with a single '$'\n const re = new RegExp(`(\\\\$\\\\$|[^$]|^)\\\\$${i + 1}`, 'g')\n if (re.test(templateString)) {\n const placeHolder = asStringOrNumber(placeholders[i], sourceCodeInfo)\n templateString = templateString.replace(re, `$1${placeHolder}`)\n }\n }\n templateString = templateString.replace(doubleDollarRegexp, '$')\n return templateString\n}\n\nexport const stringUtilsModule: LitsModule = {\n name: 'string',\n functions: stringUtilsFunctions,\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"],"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","isLitsFunction","func","type","functionType","has","isNode","value","Array","isArray","valueToString","keys","find","key","RegExp","toString","JSON","stringify","getSourceCodeInfo","anyValue","asNonUndefined","undefined","isNonUndefined","assertNonUndefined","getAssertionError","typeName","assertNumber","options","isNaN","integer","isInteger","finite","isFinite","zero","nonZero","positive","negative","nonPositive","nonNegative","gt","gte","lt","lte","isNumber","sign","getSignString","numberType","range","getRangeString","filter","x","join","getNumberTypeName","assertString","nonEmpty","char","isString","asStringOrNumber","isStringOrNumber","assertStringOrNumber","toFixedArity","arity","min","stringUtilsFunctions","evaluate","str","count","docs","category","returns","args","a","b","s","n","variants","argumentNames","description","seeAlso","examples","num","int","ceil","toNonNegativeInteger","fromCodePoint","error","codePointAt","c","replace","split","padString","padStart","padEnd","template","templateString","placeholders","assertArray","templateStrings","applyPlaceholders","stringPlaceholders","slice","params","rest","hideOperatorForm","btoa","encodeURIComponent","_match","p1","fromCharCode","parseInt","decodeURIComponent","map","call","atob","charCodeAt","base64string","capitalize","charAt","toUpperCase","toLowerCase","doubleDollarRegexp","i","re","test","placeHolder","stringUtilsModule","functions"],"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,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AAa,wFACbC,QAAS,CAAC,aAAc,cACxBC,SAAU,CACR,8DACA,8DACA,8DACA,4DAMFyC,EAAqB,QAC3B,SAAStB,EAAkBJ,EAAwBC,EAAyBvI,GAC1E,IAAK,IAAIiK,EAAI,EAAGA,EAAI,EAAGA,GAAK,EAAG,CAI7B,MAAMC,EAAK,IAAI5G,OAAO,qBAAqB2G,EAAI,IAAK,KACpD,GAAIC,EAAGC,KAAK7B,GAAiB,CAC3B,MAAM8B,EAAcnE,EAAiBsC,EAAa0B,GAAIjK,GACtDsI,EAAiBA,EAAeN,QAAQkC,EAAI,KAAKE,IAClD,CACF,CAED,OADA9B,EAAiBA,EAAeN,QAAQgC,EAAoB,IAE9D,CAEa,MAAAK,EAAgC,CAC3C5I,KAAM,SACN6I,UAAW/D"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function t(t){if(!t.position||!t.code)return"";const e=t.position.column-1,r=t.code.length-e-1;return`${" ".repeat(Math.max(e,0))}^${" ".repeat(Math.max(r,0))}`}class e extends Error{sourceCodeInfo;shortMessage;constructor(r,n){const i=r instanceof Error?r.message:`${r}`;super(function(e,r){if(!r)return e;const n=`${r.position.line}:${r.position.column}`;return`${e}${r.filePath?`\n${r.filePath}:${n}`:`\nLocation ${n}`}\n${r.code}\n${t(r)}`}(i,n)),this.shortMessage=i,this.sourceCodeInfo=n,Object.setPrototypeOf(this,e.prototype),this.name="LitsError"}getCodeMarker(){return this.sourceCodeInfo&&t(this.sourceCodeInfo)}}const r={Number:1,String:2,NormalExpression:3,SpecialExpression:4,UserDefinedSymbol:5,NormalBuiltinSymbol:6,SpecialBuiltinSymbol:7,ReservedSymbol:8,Binding:9,Spread:10},n=new Set(Object.values(r));const i=new Set(["UserDefined","Partial","Comp","Constantly","Juxt","Complement","EveryPred","SomePred","Fnull","Builtin","SpecialBuiltin","NativeJsFunction","Module"]);function o(t){return null!==t&&"object"==typeof t&&("^^fn^^"in t&&"functionType"in t&&("string"==typeof(e=t.functionType)&&i.has(e)));var e}function s(t){return!(!Array.isArray(t)||t.length<2)&&("number"==typeof(e=t[0])&&n.has(e));var e}function a(t){return o(t)?`<function ${t.name||"λ"}>`:s(t)?`${e=t[0],Object.keys(r).find(t=>r[t]===e)}-node`:null===t?"null":"object"==typeof t&&t instanceof RegExp?`${t}`:"object"==typeof t&&t instanceof Error?t.toString():JSON.stringify(t);var e}function p(t,e){return t?.sourceCodeInfo??e}function l(t,r){return function(t,r){if(!function(t){return void 0!==t}(t))throw new e("Unexpected undefined",p(t,r))}(t,r),t}function g(t,r,n){return new e(`Expected ${t}, got ${a(r)}.`,p(r,n))}function m(t,r,n={}){if(!function(t,e={}){return!("number"!=typeof t||Number.isNaN(t)||e.integer&&!Number.isInteger(t)||e.finite&&!Number.isFinite(t)||e.zero&&0!==t||e.nonZero&&0===t||e.positive&&t<=0||e.negative&&t>=0||e.nonPositive&&t>0||e.nonNegative&&t<0||"number"==typeof e.gt&&t<=e.gt||"number"==typeof e.gte&&t<e.gte||"number"==typeof e.lt&&t>=e.lt||"number"==typeof e.lte&&t>e.lte)}(t,n))throw new e(`Expected ${function(t){if(t.zero)return"zero";const e=function(t){return t.positive?"positive":t.negative?"negative":t.nonNegative?"non negative":t.nonPositive?"non positive":t.nonZero?"non zero":""}(t),r=t.integer?"integer":"number",n=t.finite?"finite":"",i=function(t){return"number"!=typeof t.gt&&"number"!=typeof t.gte||"number"!=typeof t.lt&&"number"!=typeof t.lte?"number"==typeof t.gt||"number"==typeof t.gte?"number"==typeof t.gt?`n > ${t.gt}`:`n >= ${t.gte}`:"number"==typeof t.lt||"number"==typeof t.lte?"number"==typeof t.lt?`n < ${t.lt}`:`n <= ${t.lte}`:"":`${"number"==typeof t.gt?`${t.gt} < n `:`${t.gte} <= n `}${"number"==typeof t.lt?`< ${t.lt}`:`<= ${t.lte}`}`}(t);return[e,n,r,i].filter(t=>!!t).join(" ")}(n)}, got ${a(t)}.`,p(t,r))}function c(t,e,r={}){if(!function(t,e={}){return!("string"!=typeof t||e.nonEmpty&&0===t.length||e.char&&1!==t.length)}(t,r))throw g(""+(r.nonEmpty?"non empty string":r.char?"character":"string"),t,e)}function u(t,e){return function(t,e){if(!function(t){return"string"==typeof t||"number"==typeof t}(t))throw g("string or number",t,e)}(t,e),t}function d(t){return{min:t,max:t}}const f={"string-repeat":{evaluate:([t,e],r)=>(c(t,r),m(e,r,{integer:!0,nonNegative:!0}),t.repeat(e)),arity:d(2),docs:{category:"string",returns:{type:"number"},args:{a:{type:"string"},b:{type:"integer"},s:{type:"string"},n:{type:"integer"}},variants:[{argumentNames:["s","n"]}],description:"Repeates $s $n times.",seeAlso:["str","repeat"],examples:['let { string-repeat } = import("string"); "*" string-repeat 10','let { string-repeat } = import("string"); string-repeat("*", 10)','let { string-repeat } = import("string"); string-repeat("***", 0)']}},"from-char-code":{evaluate:([t],r)=>{m(t,r,{finite:!0});const n=function(t){return Math.max(0,Math.ceil(t))}(t);try{return String.fromCodePoint(n)}catch(t){throw new e(t,r)}},arity:d(1),docs:{category:"string",returns:{type:"string"},args:{code:{type:"number"}},variants:[{argumentNames:["code"]}],description:"Return character for code point $code.",seeAlso:["string.to-char-code"],examples:['let { from-char-code } = import("string"); from-char-code(65)','let { from-char-code } = import("string"); from-char-code(0)']}},"to-char-code":{evaluate:([t],e)=>(c(t,e,{nonEmpty:!0}),l(t.codePointAt(0),e)),arity:d(1),docs:{category:"string",returns:{type:"number"},args:{c:{type:"string"}},variants:[{argumentNames:["c"]}],description:"Return code point for first character in $c.",seeAlso:["string.from-char-code"],examples:['let { to-char-code } = import("string"); to-char-code("A")','let { to-char-code } = import("string"); to-char-code("Albert")']}},"trim-left":{evaluate:([t],e)=>(c(t,e),t.replace(/^\s+/,"")),arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Returns a new string with leading whitespaces removed.",seeAlso:["trim","string.trim-right"],examples:['let { trim-left } = import("string"); trim-left(" Albert ")','let { trim-left } = import("string"); trim-left(" ")','let { trim-left } = import("string"); trim-left("")']}},"trim-right":{evaluate:([t],e)=>(c(t,e),t.replace(/\s+$/,"")),arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Returns a new string with trailing whitespaces removed.",seeAlso:["trim","string.trim-left"],examples:['let { trim-right } = import("string"); trim-right(" Albert ")','let { trim-right } = import("string"); trim-right(" ")','let { trim-right } = import("string"); trim-right("")']}},"split-lines":{evaluate:([t],e)=>(c(t,e),t.split(/\r\n|\n|\r/).filter(t=>""!==t)),arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Divides $s into an array of substrings, each representing a line.",seeAlso:["split"],examples:['let { split-lines } = import("string"); split-lines("Albert\nMojir\n")','let { split-lines } = import("string"); split-lines("Albert\n\nMojir")','let { split-lines } = import("string"); split-lines("Albert\nMojir\n\n")','let { split-lines } = import("string"); split-lines("")']}},"pad-left":{evaluate:([t,e,r],n)=>(c(t,n),m(e,n,{integer:!0}),void 0!==r&&c(r,n),t.padStart(e,r)),arity:{min:2,max:3},docs:{category:"string",returns:{type:"string"},args:{a:{type:"string"},b:{type:"integer"},s:{type:"string"},length:{type:"integer"},padString:{type:"string"}},variants:[{argumentNames:["s","length"]},{argumentNames:["s","length","padString"]}],description:"Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given $length.",seeAlso:["string.pad-right"],examples:['let { pad-left } = import("string"); "Albert" pad-left 20','let { pad-left } = import("string"); pad-left("Albert", 20)','let { pad-left } = import("string"); pad-left("Albert", 20, "-*-")','let { pad-left } = import("string"); pad-left("Albert", 5)','let { pad-left } = import("string"); pad-left("Albert", -1)']}},"pad-right":{evaluate:([t,e,r],n)=>(c(t,n),m(e,n,{integer:!0}),void 0!==r&&c(r,n),t.padEnd(e,r)),arity:{min:2,max:3},docs:{category:"string",returns:{type:"string"},args:{a:{type:"string"},b:{type:"integer"},s:{type:"string"},length:{type:"integer"},padString:{type:"string"}},variants:[{argumentNames:["s","length"]},{argumentNames:["s","length","padString"]}],description:"Pads from the start of $s with `padString` (multiple times, if needed) until the resulting string reaches the given `length`.",seeAlso:["string.pad-left"],examples:['let { pad-right } = import("string"); "Albert" pad-right 20','let { pad-right } = import("string"); pad-right("Albert", 20)','let { pad-right } = import("string"); pad-right("Albert", 20, "-*-")','let { pad-right } = import("string"); pad-right("Albert", 5)','let { pad-right } = import("string"); pad-right("Albert", -1)']}},template:{evaluate:([t,...e],r)=>{c(t,r),function(t,e){if(!Array.isArray(t))throw g("array",t,e)}(e,r);const n=t.split("||||");if(n.length<=1)return b(n[0],e,r);{const t=e[0];m(t,r,{integer:!0,nonNegative:!0});const i=[`${t}`,...e.slice(1)];if(2===n.length){return b(n[1===t?0:1],i,r)}return b(n[Math.min(t,n.length-1)],i,r)}},arity:{min:1,max:10},docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"},params:{type:"any",rest:!0}},variants:[{argumentNames:["s","params"]}],description:"Applies placeholders to a string. Support for basic pluralization - see examples. If pluralization is used, first placeholder must be a number.",seeAlso:["str"],examples:['let { template } = import("string"); template("Hi, $1 and $2", "Carl", "Larry")','let { template } = import("string"); template("Hi $1, $2, $3, $4, $5, $6, $7, $8 and $9", "A", "B", "C", "D", "E", "F", "G", "H", "I")','let { template } = import("string"); template("$1 book||||$1 books", 0)','let { template } = import("string"); template("$1 book||||$1 books", 1)','let { template } = import("string"); template("$1 book||||$1 books", 2)','let { template } = import("string"); template("No book||||$1 book||||$1 books", 0)','let { template } = import("string"); template("No book||||$1 book||||$1 books", 1)','let { template } = import("string"); template("No book||||$1 book||||$1 books", 10)','let { template } = import("string"); template("No book||||One book||||Two books||||Three books||||$1 books", 0)','let { template } = import("string"); template("No book||||One book||||Two books||||Three books||||$1 books", 1)','let { template } = import("string"); template("No book||||One book||||Two books||||Three books||||$1 books", 2)','let { template } = import("string"); template("No book||||One book||||Two books||||Three books||||$1 books", 3)','let { template } = import("string"); template("No book||||One book||||Two books||||Three books||||$1 books", 4)'],hideOperatorForm:!0}},"encode-base64":{evaluate:([t],e)=>(c(t,e),btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(Number.parseInt(e,16))))),arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Returns a Base64 encoded string from $s.",seeAlso:["string.decode-base64"],examples:['let { encode-base64 } = import("string"); encode-base64("Albert")']}},"decode-base64":{evaluate:([t],r)=>{c(t,r);try{return decodeURIComponent(Array.prototype.map.call(atob(t),t=>`%${`00${t.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}catch(t){throw new e(t,r)}},arity:d(1),docs:{category:"string",returns:{type:"string"},args:{base64string:{type:"string"}},variants:[{argumentNames:["base64string"]}],description:"Returns a Base64 decoded string from $base64string.",seeAlso:["string.encode-base64"],examples:['let { decode-base64 } = import("string"); decode-base64("QWxiZXJ0IPCfkLs=")']}},"encode-uri-component":{evaluate:([t],e)=>(c(t,e),encodeURIComponent(t)),arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Returns an escaped `URI` string.",seeAlso:["string.decode-uri-component"],examples:['let { encode-uri-component } = import("string"); encode-uri-component("Hi everyone!?")']}},"decode-uri-component":{evaluate:([t],r)=>{c(t,r);try{return decodeURIComponent(t)}catch(t){throw new e(t,r)}},arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Returns an un-escaped `URI` string.",seeAlso:["string.encode-uri-component"],examples:['let { decode-uri-component } = import("string"); decode-uri-component("Hi%20everyone!%3F%20%F0%9F%91%8D")']}},capitalize:{evaluate:([t],e)=>(c(t,e),t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()),arity:d(1),docs:{category:"string",returns:{type:"string"},args:{s:{type:"string"}},variants:[{argumentNames:["s"]}],description:"Returns $s with the first character converted to uppercase and the rest to lowercase.",seeAlso:["lower-case","upper-case"],examples:['let { capitalize } = import("string"); capitalize("albert")','let { capitalize } = import("string"); capitalize("ALBERT")','let { capitalize } = import("string"); capitalize("aLBERT")','let { capitalize } = import("string"); capitalize("")']}}},y=/\$\$/g;function b(t,e,r){for(let n=0;n<9;n+=1){const i=new RegExp(`(\\$\\$|[^$]|^)\\$${n+1}`,"g");if(i.test(t)){const o=u(e[n],r);t=t.replace(i,`$1${o}`)}}return t=t.replace(y,"$")}const h={name:"string",functions:f};exports.stringUtilsModule=h;
|
|
2
|
+
//# sourceMappingURL=string.js.map
|