@mojir/dvala 0.0.1 → 0.0.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.
Files changed (914) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1613 -4
  3. package/dist/bundler.esm.js +2 -0
  4. package/dist/bundler.esm.js.map +1 -0
  5. package/dist/bundler.js +2 -0
  6. package/dist/bundler.js.map +1 -0
  7. package/dist/cli/cli/src/cli.d.ts +2 -0
  8. package/dist/cli/cli/src/cliDocumentation/formatCliDescription.d.ts +3 -0
  9. package/dist/cli/cli/src/cliDocumentation/getCliArgumentInfo.d.ts +3 -0
  10. package/dist/cli/cli/src/cliDocumentation/getCliDocumentation.d.ts +2 -0
  11. package/dist/cli/cli/src/cliDocumentation/getCliFunctionExamples.d.ts +3 -0
  12. package/dist/cli/cli/src/cliDocumentation/getCliFunctionSignature.d.ts +3 -0
  13. package/dist/cli/cli/src/cliDocumentation/getCliTitle.d.ts +3 -0
  14. package/dist/cli/cli/src/cliDocumentation/getCliType.d.ts +3 -0
  15. package/dist/cli/cli/src/cliFormatterRules.d.ts +13 -0
  16. package/dist/cli/cli/src/colorizer.d.ts +939 -0
  17. package/dist/cli/cli/src/createReadlineInterface.d.ts +5 -0
  18. package/dist/cli/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
  19. package/dist/cli/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
  20. package/dist/cli/cli/src/js-interop/Cli/index.d.ts +2 -0
  21. package/dist/cli/cli.js +38614 -0
  22. package/dist/cli/common/createFormatter.d.ts +6 -0
  23. package/dist/cli/common/utils.d.ts +2 -0
  24. package/dist/cli/reference/api.d.ts +75 -0
  25. package/dist/cli/reference/datatype.d.ts +3 -0
  26. package/dist/cli/reference/effect.d.ts +3 -0
  27. package/dist/cli/reference/examples.d.ts +11 -0
  28. package/dist/cli/reference/index.d.ts +191 -0
  29. package/dist/cli/reference/shorthand.d.ts +3 -0
  30. package/dist/cli/src/AutoCompleter/AutoCompleter.d.ts +25 -0
  31. package/dist/cli/src/Dvala/Cache.d.ts +16 -0
  32. package/dist/cli/src/Dvala/Dvala.d.ts +68 -0
  33. package/dist/cli/src/allModules.d.ts +2 -0
  34. package/dist/cli/src/builtin/bindingNode.d.ts +11 -0
  35. package/dist/cli/src/builtin/core/array.d.ts +2 -0
  36. package/dist/cli/src/builtin/core/assertion.d.ts +2 -0
  37. package/dist/cli/src/builtin/core/bitwise.d.ts +2 -0
  38. package/dist/cli/src/builtin/core/collection.d.ts +2 -0
  39. package/dist/cli/src/builtin/core/functional.d.ts +2 -0
  40. package/dist/cli/src/builtin/core/math.d.ts +2 -0
  41. package/dist/cli/src/builtin/core/meta.d.ts +3 -0
  42. package/dist/cli/src/builtin/core/misc.d.ts +2 -0
  43. package/dist/cli/src/builtin/core/object.d.ts +2 -0
  44. package/dist/cli/src/builtin/core/predicates.d.ts +2 -0
  45. package/dist/cli/src/builtin/core/regexp.d.ts +2 -0
  46. package/dist/cli/src/builtin/core/sequence.d.ts +2 -0
  47. package/dist/cli/src/builtin/core/string.d.ts +2 -0
  48. package/dist/cli/src/builtin/core/vector.d.ts +2 -0
  49. package/dist/cli/src/builtin/index.d.ts +13 -0
  50. package/dist/cli/src/builtin/interface.d.ts +113 -0
  51. package/dist/cli/src/builtin/modules/assertion/docs.d.ts +2 -0
  52. package/dist/cli/src/builtin/modules/assertion/index.d.ts +2 -0
  53. package/dist/cli/src/builtin/modules/bitwise/index.d.ts +2 -0
  54. package/dist/cli/src/builtin/modules/collection/index.d.ts +2 -0
  55. package/dist/cli/src/builtin/modules/convert/index.d.ts +2 -0
  56. package/dist/cli/src/builtin/modules/functional/index.d.ts +2 -0
  57. package/dist/cli/src/builtin/modules/grid/docs.d.ts +2 -0
  58. package/dist/cli/src/builtin/modules/grid/fromArray.d.ts +8 -0
  59. package/dist/cli/src/builtin/modules/grid/index.d.ts +2 -0
  60. package/dist/cli/src/builtin/modules/grid/transpose.d.ts +2 -0
  61. package/dist/cli/src/builtin/modules/interface.d.ts +11 -0
  62. package/dist/cli/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
  63. package/dist/cli/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
  64. package/dist/cli/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
  65. package/dist/cli/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
  66. package/dist/cli/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
  67. package/dist/cli/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
  68. package/dist/cli/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
  69. package/dist/cli/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
  70. package/dist/cli/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
  71. package/dist/cli/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
  72. package/dist/cli/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
  73. package/dist/cli/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
  74. package/dist/cli/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
  75. package/dist/cli/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
  76. package/dist/cli/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
  77. package/dist/cli/src/builtin/modules/linear-algebra/index.d.ts +4 -0
  78. package/dist/cli/src/builtin/modules/math/index.d.ts +2 -0
  79. package/dist/cli/src/builtin/modules/matrix/docs.d.ts +2 -0
  80. package/dist/cli/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
  81. package/dist/cli/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
  82. package/dist/cli/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
  83. package/dist/cli/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
  84. package/dist/cli/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
  85. package/dist/cli/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
  86. package/dist/cli/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
  87. package/dist/cli/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
  88. package/dist/cli/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
  89. package/dist/cli/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
  90. package/dist/cli/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
  91. package/dist/cli/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
  92. package/dist/cli/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
  93. package/dist/cli/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
  94. package/dist/cli/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
  95. package/dist/cli/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
  96. package/dist/cli/src/builtin/modules/matrix/index.d.ts +4 -0
  97. package/dist/cli/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
  98. package/dist/cli/src/builtin/modules/number-theory/combinations.d.ts +2 -0
  99. package/dist/cli/src/builtin/modules/number-theory/derangements.d.ts +2 -0
  100. package/dist/cli/src/builtin/modules/number-theory/divisors.d.ts +4 -0
  101. package/dist/cli/src/builtin/modules/number-theory/docs.d.ts +2 -0
  102. package/dist/cli/src/builtin/modules/number-theory/factorial.d.ts +3 -0
  103. package/dist/cli/src/builtin/modules/number-theory/index.d.ts +4 -0
  104. package/dist/cli/src/builtin/modules/number-theory/partitions.d.ts +2 -0
  105. package/dist/cli/src/builtin/modules/number-theory/permutations.d.ts +2 -0
  106. package/dist/cli/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
  107. package/dist/cli/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
  108. package/dist/cli/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
  109. package/dist/cli/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
  110. package/dist/cli/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
  111. package/dist/cli/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
  112. package/dist/cli/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
  113. package/dist/cli/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
  114. package/dist/cli/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
  115. package/dist/cli/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
  116. package/dist/cli/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
  117. package/dist/cli/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
  118. package/dist/cli/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
  119. package/dist/cli/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
  120. package/dist/cli/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
  121. package/dist/cli/src/builtin/modules/number-theory/sequences/index.d.ts +27 -0
  122. package/dist/cli/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
  123. package/dist/cli/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
  124. package/dist/cli/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
  125. package/dist/cli/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
  126. package/dist/cli/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
  127. package/dist/cli/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
  128. package/dist/cli/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
  129. package/dist/cli/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
  130. package/dist/cli/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
  131. package/dist/cli/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
  132. package/dist/cli/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
  133. package/dist/cli/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
  134. package/dist/cli/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
  135. package/dist/cli/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
  136. package/dist/cli/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
  137. package/dist/cli/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
  138. package/dist/cli/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
  139. package/dist/cli/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
  140. package/dist/cli/src/builtin/modules/random/docs.d.ts +2 -0
  141. package/dist/cli/src/builtin/modules/random/index.d.ts +2 -0
  142. package/dist/cli/src/builtin/modules/sequence/index.d.ts +2 -0
  143. package/dist/cli/src/builtin/modules/string/index.d.ts +2 -0
  144. package/dist/cli/src/builtin/modules/vector/bincount.d.ts +9 -0
  145. package/dist/cli/src/builtin/modules/vector/calcMad.d.ts +1 -0
  146. package/dist/cli/src/builtin/modules/vector/calcMean.d.ts +1 -0
  147. package/dist/cli/src/builtin/modules/vector/calcMedad.d.ts +1 -0
  148. package/dist/cli/src/builtin/modules/vector/calcMedian.d.ts +1 -0
  149. package/dist/cli/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
  150. package/dist/cli/src/builtin/modules/vector/calcVariance.d.ts +2 -0
  151. package/dist/cli/src/builtin/modules/vector/docs.d.ts +2 -0
  152. package/dist/cli/src/builtin/modules/vector/entropy.d.ts +8 -0
  153. package/dist/cli/src/builtin/modules/vector/histogram.d.ts +9 -0
  154. package/dist/cli/src/builtin/modules/vector/index.d.ts +2 -0
  155. package/dist/cli/src/builtin/modules/vector/mode.d.ts +6 -0
  156. package/dist/cli/src/builtin/modules/vector/outliers.d.ts +7 -0
  157. package/dist/cli/src/builtin/modules/vector/percentile.d.ts +7 -0
  158. package/dist/cli/src/builtin/modules/vector/quartiles.d.ts +1 -0
  159. package/dist/cli/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
  160. package/dist/cli/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
  161. package/dist/cli/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
  162. package/dist/cli/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
  163. package/dist/cli/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
  164. package/dist/cli/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
  165. package/dist/cli/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
  166. package/dist/cli/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
  167. package/dist/cli/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
  168. package/dist/cli/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
  169. package/dist/cli/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
  170. package/dist/cli/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
  171. package/dist/cli/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
  172. package/dist/cli/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
  173. package/dist/cli/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
  174. package/dist/cli/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
  175. package/dist/cli/src/builtin/normalExpressions/index.d.ts +8 -0
  176. package/dist/cli/src/builtin/specialExpressionTypes.d.ts +26 -0
  177. package/dist/cli/src/builtin/specialExpressions/and.d.ts +6 -0
  178. package/dist/cli/src/builtin/specialExpressions/array.d.ts +6 -0
  179. package/dist/cli/src/builtin/specialExpressions/block.d.ts +6 -0
  180. package/dist/cli/src/builtin/specialExpressions/cond.d.ts +6 -0
  181. package/dist/cli/src/builtin/specialExpressions/defined.d.ts +5 -0
  182. package/dist/cli/src/builtin/specialExpressions/effect.d.ts +5 -0
  183. package/dist/cli/src/builtin/specialExpressions/functions.d.ts +6 -0
  184. package/dist/cli/src/builtin/specialExpressions/if.d.ts +6 -0
  185. package/dist/cli/src/builtin/specialExpressions/import.d.ts +6 -0
  186. package/dist/cli/src/builtin/specialExpressions/let.d.ts +6 -0
  187. package/dist/cli/src/builtin/specialExpressions/loop.d.ts +6 -0
  188. package/dist/cli/src/builtin/specialExpressions/loops.d.ts +9 -0
  189. package/dist/cli/src/builtin/specialExpressions/match.d.ts +7 -0
  190. package/dist/cli/src/builtin/specialExpressions/object.d.ts +6 -0
  191. package/dist/cli/src/builtin/specialExpressions/or.d.ts +6 -0
  192. package/dist/cli/src/builtin/specialExpressions/parallel.d.ts +6 -0
  193. package/dist/cli/src/builtin/specialExpressions/perform.d.ts +6 -0
  194. package/dist/cli/src/builtin/specialExpressions/qq.d.ts +6 -0
  195. package/dist/cli/src/builtin/specialExpressions/race.d.ts +6 -0
  196. package/dist/cli/src/builtin/specialExpressions/recur.d.ts +5 -0
  197. package/dist/cli/src/builtin/specialExpressions/throw.d.ts +5 -0
  198. package/dist/cli/src/builtin/specialExpressions/try.d.ts +7 -0
  199. package/dist/cli/src/builtin/specialExpressions/unless.d.ts +6 -0
  200. package/dist/cli/src/builtin/utils.d.ts +6 -0
  201. package/dist/cli/src/bundler/index.d.ts +9 -0
  202. package/dist/cli/src/bundler/interface.d.ts +15 -0
  203. package/dist/cli/src/bundler.d.ts +3 -0
  204. package/dist/cli/src/cli.d.ts +2 -0
  205. package/dist/cli/src/cliDocumentation/formatCliDescription.d.ts +3 -0
  206. package/dist/cli/src/cliDocumentation/getCliArgumentInfo.d.ts +3 -0
  207. package/dist/cli/src/cliDocumentation/getCliDocumentation.d.ts +2 -0
  208. package/dist/cli/src/cliDocumentation/getCliFunctionExamples.d.ts +3 -0
  209. package/dist/cli/src/cliDocumentation/getCliFunctionSignature.d.ts +3 -0
  210. package/dist/cli/src/cliDocumentation/getCliTitle.d.ts +3 -0
  211. package/dist/cli/src/cliDocumentation/getCliType.d.ts +3 -0
  212. package/dist/cli/src/cliFormatterRules.d.ts +13 -0
  213. package/dist/cli/src/colorizer.d.ts +939 -0
  214. package/dist/cli/src/constants/constants.d.ts +19 -0
  215. package/dist/cli/src/createReadlineInterface.d.ts +5 -0
  216. package/dist/cli/src/effects.d.ts +106 -0
  217. package/dist/cli/src/errors.d.ts +24 -0
  218. package/dist/cli/src/evaluator/ContextStack.d.ts +65 -0
  219. package/dist/cli/src/evaluator/effectRef.d.ts +27 -0
  220. package/dist/cli/src/evaluator/effectTypes.d.ts +79 -0
  221. package/dist/cli/src/evaluator/frames.d.ts +525 -0
  222. package/dist/cli/src/evaluator/interface.d.ts +14 -0
  223. package/dist/cli/src/evaluator/serialization.d.ts +45 -0
  224. package/dist/cli/src/evaluator/standardEffects.d.ts +35 -0
  225. package/dist/cli/src/evaluator/step.d.ts +159 -0
  226. package/dist/cli/src/evaluator/suspension.d.ts +53 -0
  227. package/dist/cli/src/evaluator/trampoline.d.ts +119 -0
  228. package/dist/cli/src/getUndefinedSymbols/index.d.ts +7 -0
  229. package/dist/cli/src/index.d.ts +18 -0
  230. package/dist/cli/src/initReferenceData.d.ts +1 -0
  231. package/dist/cli/src/interface.d.ts +7 -0
  232. package/dist/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
  233. package/dist/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
  234. package/dist/cli/src/js-interop/Cli/index.d.ts +2 -0
  235. package/dist/cli/src/parser/ParserContext.d.ts +20 -0
  236. package/dist/cli/src/parser/getPrecedence.d.ts +3 -0
  237. package/dist/cli/src/parser/helpers.d.ts +19 -0
  238. package/dist/cli/src/parser/index.d.ts +5 -0
  239. package/dist/cli/src/parser/subParsers/parseArray.d.ts +3 -0
  240. package/dist/cli/src/parser/subParsers/parseBindingTarget.d.ts +8 -0
  241. package/dist/cli/src/parser/subParsers/parseCond.d.ts +4 -0
  242. package/dist/cli/src/parser/subParsers/parseDo.d.ts +3 -0
  243. package/dist/cli/src/parser/subParsers/parseExpression.d.ts +5 -0
  244. package/dist/cli/src/parser/subParsers/parseForOrDoseq.d.ts +4 -0
  245. package/dist/cli/src/parser/subParsers/parseFunction.d.ts +4 -0
  246. package/dist/cli/src/parser/subParsers/parseFunctionCall.d.ts +3 -0
  247. package/dist/cli/src/parser/subParsers/parseIfOrUnless.d.ts +5 -0
  248. package/dist/cli/src/parser/subParsers/parseImplicitBlock.d.ts +5 -0
  249. package/dist/cli/src/parser/subParsers/parseLet.d.ts +4 -0
  250. package/dist/cli/src/parser/subParsers/parseLoop.d.ts +4 -0
  251. package/dist/cli/src/parser/subParsers/parseMatch.d.ts +4 -0
  252. package/dist/cli/src/parser/subParsers/parseNumber.d.ts +3 -0
  253. package/dist/cli/src/parser/subParsers/parseObject.d.ts +3 -0
  254. package/dist/cli/src/parser/subParsers/parseOperand.d.ts +3 -0
  255. package/dist/cli/src/parser/subParsers/parseRegexpShorthand.d.ts +3 -0
  256. package/dist/cli/src/parser/subParsers/parseReservedSymbol.d.ts +3 -0
  257. package/dist/cli/src/parser/subParsers/parseString.d.ts +4 -0
  258. package/dist/cli/src/parser/subParsers/parseSymbol.d.ts +3 -0
  259. package/dist/cli/src/parser/subParsers/parseTry.d.ts +4 -0
  260. package/dist/cli/src/parser/types.d.ts +129 -0
  261. package/dist/cli/src/symbolPatterns.d.ts +2 -0
  262. package/dist/cli/src/testFramework/index.d.ts +15 -0
  263. package/dist/cli/src/tokenizer/minifyTokenStream.d.ts +4 -0
  264. package/dist/cli/src/tokenizer/operators.d.ts +12 -0
  265. package/dist/cli/src/tokenizer/reservedNames.d.ts +66 -0
  266. package/dist/cli/src/tokenizer/token.d.ts +84 -0
  267. package/dist/cli/src/tokenizer/tokenize.d.ts +8 -0
  268. package/dist/cli/src/tokenizer/tokenizers.d.ts +14 -0
  269. package/dist/cli/src/transformer/index.d.ts +2 -0
  270. package/dist/cli/src/typeGuards/annotatedArrays.d.ts +16 -0
  271. package/dist/cli/src/typeGuards/array.d.ts +9 -0
  272. package/dist/cli/src/typeGuards/astNode.d.ts +19 -0
  273. package/dist/cli/src/typeGuards/dvala.d.ts +26 -0
  274. package/dist/cli/src/typeGuards/dvalaFunction.d.ts +12 -0
  275. package/dist/cli/src/typeGuards/index.d.ts +7 -0
  276. package/dist/cli/src/typeGuards/number.d.ts +66 -0
  277. package/dist/cli/src/typeGuards/string.d.ts +15 -0
  278. package/dist/cli/src/untokenizer/index.d.ts +2 -0
  279. package/dist/cli/src/utils/arity.d.ts +10 -0
  280. package/dist/cli/src/utils/debug/debugTools.d.ts +1 -0
  281. package/dist/cli/src/utils/debug/getCodeMarker.d.ts +2 -0
  282. package/dist/cli/src/utils/debug/getSourceCodeInfo.d.ts +2 -0
  283. package/dist/cli/src/utils/docString/generateDocString.d.ts +2 -0
  284. package/dist/cli/src/utils/getAssertionError.d.ts +3 -0
  285. package/dist/cli/src/utils/index.d.ts +14 -0
  286. package/dist/cli/src/utils/maybePromise.d.ts +54 -0
  287. package/dist/cli/src/utils/symbols.d.ts +3 -0
  288. package/dist/common/createFormatter.d.ts +6 -0
  289. package/dist/common/utils.d.ts +2 -0
  290. package/dist/debug.esm.js +2 -0
  291. package/dist/debug.esm.js.map +1 -0
  292. package/dist/debug.js +2 -0
  293. package/dist/debug.js.map +1 -0
  294. package/dist/dvala.iife.js +2 -0
  295. package/dist/dvala.iife.js.map +1 -0
  296. package/dist/full.esm.js +2 -0
  297. package/dist/full.esm.js.map +1 -0
  298. package/dist/full.js +2 -0
  299. package/dist/full.js.map +1 -0
  300. package/dist/index.esm.js +2 -0
  301. package/dist/index.esm.js.map +1 -0
  302. package/dist/index.js +2 -2
  303. package/dist/index.js.map +1 -1
  304. package/dist/modules/assertion.esm.js +2 -0
  305. package/dist/modules/assertion.esm.js.map +1 -0
  306. package/dist/modules/assertion.js +2 -0
  307. package/dist/modules/assertion.js.map +1 -0
  308. package/dist/modules/bitwise.esm.js +2 -0
  309. package/dist/modules/bitwise.esm.js.map +1 -0
  310. package/dist/modules/bitwise.js +2 -0
  311. package/dist/modules/bitwise.js.map +1 -0
  312. package/dist/modules/cli/src/cli.d.ts +2 -0
  313. package/dist/modules/cli/src/cliDocumentation/formatCliDescription.d.ts +3 -0
  314. package/dist/modules/cli/src/cliDocumentation/getCliArgumentInfo.d.ts +3 -0
  315. package/dist/modules/cli/src/cliDocumentation/getCliDocumentation.d.ts +2 -0
  316. package/dist/modules/cli/src/cliDocumentation/getCliFunctionExamples.d.ts +3 -0
  317. package/dist/modules/cli/src/cliDocumentation/getCliFunctionSignature.d.ts +3 -0
  318. package/dist/modules/cli/src/cliDocumentation/getCliTitle.d.ts +3 -0
  319. package/dist/modules/cli/src/cliDocumentation/getCliType.d.ts +3 -0
  320. package/dist/modules/cli/src/cliFormatterRules.d.ts +13 -0
  321. package/dist/modules/cli/src/colorizer.d.ts +939 -0
  322. package/dist/modules/cli/src/createReadlineInterface.d.ts +5 -0
  323. package/dist/modules/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
  324. package/dist/modules/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
  325. package/dist/modules/cli/src/js-interop/Cli/index.d.ts +2 -0
  326. package/dist/modules/collection.esm.js +2 -0
  327. package/dist/modules/collection.esm.js.map +1 -0
  328. package/dist/modules/collection.js +2 -0
  329. package/dist/modules/collection.js.map +1 -0
  330. package/dist/modules/common/createFormatter.d.ts +6 -0
  331. package/dist/modules/common/utils.d.ts +2 -0
  332. package/dist/modules/convert.esm.js +2 -0
  333. package/dist/modules/convert.esm.js.map +1 -0
  334. package/dist/modules/convert.js +2 -0
  335. package/dist/modules/convert.js.map +1 -0
  336. package/dist/modules/functional.esm.js +2 -0
  337. package/dist/modules/functional.esm.js.map +1 -0
  338. package/dist/modules/functional.js +2 -0
  339. package/dist/modules/functional.js.map +1 -0
  340. package/dist/modules/grid.esm.js +2 -0
  341. package/dist/modules/grid.esm.js.map +1 -0
  342. package/dist/modules/grid.js +2 -0
  343. package/dist/modules/grid.js.map +1 -0
  344. package/dist/modules/linear-algebra.esm.js +2 -0
  345. package/dist/modules/linear-algebra.esm.js.map +1 -0
  346. package/dist/modules/linear-algebra.js +2 -0
  347. package/dist/modules/linear-algebra.js.map +1 -0
  348. package/dist/modules/math.esm.js +2 -0
  349. package/dist/modules/math.esm.js.map +1 -0
  350. package/dist/modules/math.js +2 -0
  351. package/dist/modules/math.js.map +1 -0
  352. package/dist/modules/matrix.esm.js +2 -0
  353. package/dist/modules/matrix.esm.js.map +1 -0
  354. package/dist/modules/matrix.js +2 -0
  355. package/dist/modules/matrix.js.map +1 -0
  356. package/dist/modules/number-theory.esm.js +2 -0
  357. package/dist/modules/number-theory.esm.js.map +1 -0
  358. package/dist/modules/number-theory.js +2 -0
  359. package/dist/modules/number-theory.js.map +1 -0
  360. package/dist/modules/random.esm.js +2 -0
  361. package/dist/modules/random.esm.js.map +1 -0
  362. package/dist/modules/random.js +2 -0
  363. package/dist/modules/random.js.map +1 -0
  364. package/dist/modules/reference/api.d.ts +75 -0
  365. package/dist/modules/reference/datatype.d.ts +3 -0
  366. package/dist/modules/reference/effect.d.ts +3 -0
  367. package/dist/modules/reference/index.d.ts +191 -0
  368. package/dist/modules/reference/shorthand.d.ts +3 -0
  369. package/dist/modules/sequence.esm.js +2 -0
  370. package/dist/modules/sequence.esm.js.map +1 -0
  371. package/dist/modules/sequence.js +2 -0
  372. package/dist/modules/sequence.js.map +1 -0
  373. package/dist/modules/src/AutoCompleter/AutoCompleter.d.ts +25 -0
  374. package/dist/modules/src/Dvala/Cache.d.ts +16 -0
  375. package/dist/modules/src/Dvala/Dvala.d.ts +68 -0
  376. package/dist/modules/src/allModules.d.ts +2 -0
  377. package/dist/modules/src/builtin/bindingNode.d.ts +11 -0
  378. package/dist/modules/src/builtin/core/array.d.ts +2 -0
  379. package/dist/modules/src/builtin/core/assertion.d.ts +2 -0
  380. package/dist/modules/src/builtin/core/bitwise.d.ts +2 -0
  381. package/dist/modules/src/builtin/core/collection.d.ts +2 -0
  382. package/dist/modules/src/builtin/core/functional.d.ts +2 -0
  383. package/dist/modules/src/builtin/core/math.d.ts +2 -0
  384. package/dist/modules/src/builtin/core/meta.d.ts +3 -0
  385. package/dist/modules/src/builtin/core/misc.d.ts +2 -0
  386. package/dist/modules/src/builtin/core/object.d.ts +2 -0
  387. package/dist/modules/src/builtin/core/predicates.d.ts +2 -0
  388. package/dist/modules/src/builtin/core/regexp.d.ts +2 -0
  389. package/dist/modules/src/builtin/core/sequence.d.ts +2 -0
  390. package/dist/modules/src/builtin/core/string.d.ts +2 -0
  391. package/dist/modules/src/builtin/core/vector.d.ts +2 -0
  392. package/dist/modules/src/builtin/index.d.ts +13 -0
  393. package/dist/modules/src/builtin/interface.d.ts +113 -0
  394. package/dist/modules/src/builtin/modules/assertion/docs.d.ts +2 -0
  395. package/dist/modules/src/builtin/modules/assertion/index.d.ts +2 -0
  396. package/dist/modules/src/builtin/modules/bitwise/index.d.ts +2 -0
  397. package/dist/modules/src/builtin/modules/collection/index.d.ts +2 -0
  398. package/dist/modules/src/builtin/modules/convert/index.d.ts +2 -0
  399. package/dist/modules/src/builtin/modules/functional/index.d.ts +2 -0
  400. package/dist/modules/src/builtin/modules/grid/docs.d.ts +2 -0
  401. package/dist/modules/src/builtin/modules/grid/fromArray.d.ts +8 -0
  402. package/dist/modules/src/builtin/modules/grid/index.d.ts +2 -0
  403. package/dist/modules/src/builtin/modules/grid/transpose.d.ts +2 -0
  404. package/dist/modules/src/builtin/modules/interface.d.ts +11 -0
  405. package/dist/modules/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
  406. package/dist/modules/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
  407. package/dist/modules/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
  408. package/dist/modules/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
  409. package/dist/modules/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
  410. package/dist/modules/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
  411. package/dist/modules/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
  412. package/dist/modules/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
  413. package/dist/modules/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
  414. package/dist/modules/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
  415. package/dist/modules/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
  416. package/dist/modules/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
  417. package/dist/modules/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
  418. package/dist/modules/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
  419. package/dist/modules/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
  420. package/dist/modules/src/builtin/modules/linear-algebra/index.d.ts +4 -0
  421. package/dist/modules/src/builtin/modules/math/index.d.ts +2 -0
  422. package/dist/modules/src/builtin/modules/matrix/docs.d.ts +2 -0
  423. package/dist/modules/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
  424. package/dist/modules/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
  425. package/dist/modules/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
  426. package/dist/modules/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
  427. package/dist/modules/src/builtin/modules/matrix/helpers/diagonal.d.ts +1 -0
  428. package/dist/modules/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
  429. package/dist/modules/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
  430. package/dist/modules/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
  431. package/dist/modules/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
  432. package/dist/modules/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
  433. package/dist/modules/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
  434. package/dist/modules/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
  435. package/dist/modules/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
  436. package/dist/modules/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
  437. package/dist/modules/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
  438. package/dist/modules/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
  439. package/dist/modules/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
  440. package/dist/modules/src/builtin/modules/matrix/index.d.ts +4 -0
  441. package/dist/modules/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
  442. package/dist/modules/src/builtin/modules/number-theory/combinations.d.ts +2 -0
  443. package/dist/modules/src/builtin/modules/number-theory/derangements.d.ts +2 -0
  444. package/dist/modules/src/builtin/modules/number-theory/divisors.d.ts +4 -0
  445. package/dist/modules/src/builtin/modules/number-theory/docs.d.ts +2 -0
  446. package/dist/modules/src/builtin/modules/number-theory/factorial.d.ts +3 -0
  447. package/dist/modules/src/builtin/modules/number-theory/index.d.ts +4 -0
  448. package/dist/modules/src/builtin/modules/number-theory/partitions.d.ts +2 -0
  449. package/dist/modules/src/builtin/modules/number-theory/permutations.d.ts +2 -0
  450. package/dist/modules/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
  451. package/dist/modules/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
  452. package/dist/modules/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
  453. package/dist/modules/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
  454. package/dist/modules/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
  455. package/dist/modules/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
  456. package/dist/modules/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
  457. package/dist/modules/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
  458. package/dist/modules/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
  459. package/dist/modules/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
  460. package/dist/modules/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
  461. package/dist/modules/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
  462. package/dist/modules/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
  463. package/dist/modules/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
  464. package/dist/modules/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
  465. package/dist/modules/src/builtin/modules/number-theory/sequences/index.d.ts +27 -0
  466. package/dist/modules/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
  467. package/dist/modules/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
  468. package/dist/modules/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
  469. package/dist/modules/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
  470. package/dist/modules/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
  471. package/dist/modules/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
  472. package/dist/modules/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
  473. package/dist/modules/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
  474. package/dist/modules/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
  475. package/dist/modules/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
  476. package/dist/modules/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
  477. package/dist/modules/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
  478. package/dist/modules/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
  479. package/dist/modules/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
  480. package/dist/modules/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
  481. package/dist/modules/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
  482. package/dist/modules/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
  483. package/dist/modules/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
  484. package/dist/modules/src/builtin/modules/random/docs.d.ts +2 -0
  485. package/dist/modules/src/builtin/modules/random/index.d.ts +2 -0
  486. package/dist/modules/src/builtin/modules/sequence/index.d.ts +2 -0
  487. package/dist/modules/src/builtin/modules/string/index.d.ts +2 -0
  488. package/dist/modules/src/builtin/modules/vector/bincount.d.ts +9 -0
  489. package/dist/modules/src/builtin/modules/vector/calcMad.d.ts +1 -0
  490. package/dist/modules/src/builtin/modules/vector/calcMean.d.ts +1 -0
  491. package/dist/modules/src/builtin/modules/vector/calcMedad.d.ts +1 -0
  492. package/dist/modules/src/builtin/modules/vector/calcMedian.d.ts +1 -0
  493. package/dist/modules/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
  494. package/dist/modules/src/builtin/modules/vector/calcVariance.d.ts +2 -0
  495. package/dist/modules/src/builtin/modules/vector/docs.d.ts +2 -0
  496. package/dist/modules/src/builtin/modules/vector/entropy.d.ts +8 -0
  497. package/dist/modules/src/builtin/modules/vector/histogram.d.ts +9 -0
  498. package/dist/modules/src/builtin/modules/vector/index.d.ts +2 -0
  499. package/dist/modules/src/builtin/modules/vector/mode.d.ts +6 -0
  500. package/dist/modules/src/builtin/modules/vector/outliers.d.ts +7 -0
  501. package/dist/modules/src/builtin/modules/vector/percentile.d.ts +7 -0
  502. package/dist/modules/src/builtin/modules/vector/quartiles.d.ts +1 -0
  503. package/dist/modules/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
  504. package/dist/modules/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
  505. package/dist/modules/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
  506. package/dist/modules/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
  507. package/dist/modules/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
  508. package/dist/modules/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
  509. package/dist/modules/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
  510. package/dist/modules/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
  511. package/dist/modules/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
  512. package/dist/modules/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
  513. package/dist/modules/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
  514. package/dist/modules/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
  515. package/dist/modules/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
  516. package/dist/modules/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
  517. package/dist/modules/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
  518. package/dist/modules/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
  519. package/dist/modules/src/builtin/normalExpressions/index.d.ts +8 -0
  520. package/dist/modules/src/builtin/specialExpressionTypes.d.ts +26 -0
  521. package/dist/modules/src/builtin/specialExpressions/and.d.ts +6 -0
  522. package/dist/modules/src/builtin/specialExpressions/array.d.ts +6 -0
  523. package/dist/modules/src/builtin/specialExpressions/block.d.ts +6 -0
  524. package/dist/modules/src/builtin/specialExpressions/cond.d.ts +6 -0
  525. package/dist/modules/src/builtin/specialExpressions/defined.d.ts +5 -0
  526. package/dist/modules/src/builtin/specialExpressions/effect.d.ts +5 -0
  527. package/dist/modules/src/builtin/specialExpressions/functions.d.ts +6 -0
  528. package/dist/modules/src/builtin/specialExpressions/if.d.ts +6 -0
  529. package/dist/modules/src/builtin/specialExpressions/import.d.ts +6 -0
  530. package/dist/modules/src/builtin/specialExpressions/let.d.ts +6 -0
  531. package/dist/modules/src/builtin/specialExpressions/loop.d.ts +6 -0
  532. package/dist/modules/src/builtin/specialExpressions/loops.d.ts +9 -0
  533. package/dist/modules/src/builtin/specialExpressions/match.d.ts +7 -0
  534. package/dist/modules/src/builtin/specialExpressions/object.d.ts +6 -0
  535. package/dist/modules/src/builtin/specialExpressions/or.d.ts +6 -0
  536. package/dist/modules/src/builtin/specialExpressions/parallel.d.ts +6 -0
  537. package/dist/modules/src/builtin/specialExpressions/perform.d.ts +6 -0
  538. package/dist/modules/src/builtin/specialExpressions/qq.d.ts +6 -0
  539. package/dist/modules/src/builtin/specialExpressions/race.d.ts +6 -0
  540. package/dist/modules/src/builtin/specialExpressions/recur.d.ts +5 -0
  541. package/dist/modules/src/builtin/specialExpressions/throw.d.ts +5 -0
  542. package/dist/modules/src/builtin/specialExpressions/try.d.ts +7 -0
  543. package/dist/modules/src/builtin/specialExpressions/unless.d.ts +6 -0
  544. package/dist/modules/src/builtin/utils.d.ts +6 -0
  545. package/dist/modules/src/bundler/index.d.ts +9 -0
  546. package/dist/modules/src/bundler/interface.d.ts +15 -0
  547. package/dist/modules/src/bundler.d.ts +3 -0
  548. package/dist/modules/src/constants/constants.d.ts +19 -0
  549. package/dist/modules/src/debug.d.ts +115 -0
  550. package/dist/modules/src/effects.d.ts +106 -0
  551. package/dist/modules/src/errors.d.ts +24 -0
  552. package/dist/modules/src/evaluator/ContextStack.d.ts +65 -0
  553. package/dist/modules/src/evaluator/effectRef.d.ts +27 -0
  554. package/dist/modules/src/evaluator/effectTypes.d.ts +79 -0
  555. package/dist/modules/src/evaluator/frames.d.ts +525 -0
  556. package/dist/modules/src/evaluator/interface.d.ts +14 -0
  557. package/dist/modules/src/evaluator/serialization.d.ts +45 -0
  558. package/dist/modules/src/evaluator/standardEffects.d.ts +35 -0
  559. package/dist/modules/src/evaluator/step.d.ts +159 -0
  560. package/dist/modules/src/evaluator/suspension.d.ts +53 -0
  561. package/dist/modules/src/evaluator/trampoline.d.ts +119 -0
  562. package/dist/modules/src/full.d.ts +17 -0
  563. package/dist/modules/src/getUndefinedSymbols/index.d.ts +7 -0
  564. package/dist/modules/src/index.d.ts +18 -0
  565. package/dist/modules/src/initReferenceData.d.ts +1 -0
  566. package/dist/modules/src/interface.d.ts +7 -0
  567. package/dist/modules/src/modules/assertion.d.ts +2 -0
  568. package/dist/modules/src/modules/bitwise.d.ts +2 -0
  569. package/dist/modules/src/modules/collection.d.ts +2 -0
  570. package/dist/modules/src/modules/convert.d.ts +2 -0
  571. package/dist/modules/src/modules/functional.d.ts +2 -0
  572. package/dist/modules/src/modules/grid.d.ts +2 -0
  573. package/dist/modules/src/modules/linear-algebra.d.ts +2 -0
  574. package/dist/modules/src/modules/math.d.ts +2 -0
  575. package/dist/modules/src/modules/matrix.d.ts +2 -0
  576. package/dist/modules/src/modules/number-theory.d.ts +2 -0
  577. package/dist/modules/src/modules/random.d.ts +2 -0
  578. package/dist/modules/src/modules/sequence.d.ts +2 -0
  579. package/dist/modules/src/modules/string.d.ts +2 -0
  580. package/dist/modules/src/modules/vector.d.ts +2 -0
  581. package/dist/modules/src/parser/ParserContext.d.ts +20 -0
  582. package/dist/modules/src/parser/getPrecedence.d.ts +3 -0
  583. package/dist/modules/src/parser/helpers.d.ts +19 -0
  584. package/dist/modules/src/parser/index.d.ts +5 -0
  585. package/dist/modules/src/parser/subParsers/parseArray.d.ts +3 -0
  586. package/dist/modules/src/parser/subParsers/parseBindingTarget.d.ts +8 -0
  587. package/dist/modules/src/parser/subParsers/parseCond.d.ts +4 -0
  588. package/dist/modules/src/parser/subParsers/parseDo.d.ts +3 -0
  589. package/dist/modules/src/parser/subParsers/parseExpression.d.ts +5 -0
  590. package/dist/modules/src/parser/subParsers/parseForOrDoseq.d.ts +4 -0
  591. package/dist/modules/src/parser/subParsers/parseFunction.d.ts +4 -0
  592. package/dist/modules/src/parser/subParsers/parseFunctionCall.d.ts +3 -0
  593. package/dist/modules/src/parser/subParsers/parseIfOrUnless.d.ts +5 -0
  594. package/dist/modules/src/parser/subParsers/parseImplicitBlock.d.ts +5 -0
  595. package/dist/modules/src/parser/subParsers/parseLet.d.ts +4 -0
  596. package/dist/modules/src/parser/subParsers/parseLoop.d.ts +4 -0
  597. package/dist/modules/src/parser/subParsers/parseMatch.d.ts +4 -0
  598. package/dist/modules/src/parser/subParsers/parseNumber.d.ts +3 -0
  599. package/dist/modules/src/parser/subParsers/parseObject.d.ts +3 -0
  600. package/dist/modules/src/parser/subParsers/parseOperand.d.ts +3 -0
  601. package/dist/modules/src/parser/subParsers/parseRegexpShorthand.d.ts +3 -0
  602. package/dist/modules/src/parser/subParsers/parseReservedSymbol.d.ts +3 -0
  603. package/dist/modules/src/parser/subParsers/parseString.d.ts +4 -0
  604. package/dist/modules/src/parser/subParsers/parseSymbol.d.ts +3 -0
  605. package/dist/modules/src/parser/subParsers/parseTry.d.ts +4 -0
  606. package/dist/modules/src/parser/types.d.ts +129 -0
  607. package/dist/modules/src/symbolPatterns.d.ts +2 -0
  608. package/dist/modules/src/testFramework/index.d.ts +15 -0
  609. package/dist/modules/src/tokenizer/minifyTokenStream.d.ts +4 -0
  610. package/dist/modules/src/tokenizer/operators.d.ts +12 -0
  611. package/dist/modules/src/tokenizer/reservedNames.d.ts +66 -0
  612. package/dist/modules/src/tokenizer/token.d.ts +84 -0
  613. package/dist/modules/src/tokenizer/tokenize.d.ts +8 -0
  614. package/dist/modules/src/tokenizer/tokenizers.d.ts +14 -0
  615. package/dist/modules/src/transformer/index.d.ts +2 -0
  616. package/dist/modules/src/typeGuards/annotatedArrays.d.ts +16 -0
  617. package/dist/modules/src/typeGuards/array.d.ts +9 -0
  618. package/dist/modules/src/typeGuards/astNode.d.ts +19 -0
  619. package/dist/modules/src/typeGuards/dvala.d.ts +26 -0
  620. package/dist/modules/src/typeGuards/dvalaFunction.d.ts +12 -0
  621. package/dist/modules/src/typeGuards/index.d.ts +7 -0
  622. package/dist/modules/src/typeGuards/number.d.ts +66 -0
  623. package/dist/modules/src/typeGuards/string.d.ts +15 -0
  624. package/dist/modules/src/untokenizer/index.d.ts +2 -0
  625. package/dist/modules/src/utils/arity.d.ts +10 -0
  626. package/dist/modules/src/utils/debug/debugTools.d.ts +1 -0
  627. package/dist/modules/src/utils/debug/getCodeMarker.d.ts +2 -0
  628. package/dist/modules/src/utils/debug/getSourceCodeInfo.d.ts +2 -0
  629. package/dist/modules/src/utils/docString/generateDocString.d.ts +2 -0
  630. package/dist/modules/src/utils/getAssertionError.d.ts +3 -0
  631. package/dist/modules/src/utils/index.d.ts +14 -0
  632. package/dist/modules/src/utils/maybePromise.d.ts +54 -0
  633. package/dist/modules/src/utils/symbols.d.ts +3 -0
  634. package/dist/modules/string.esm.js +2 -0
  635. package/dist/modules/string.esm.js.map +1 -0
  636. package/dist/modules/string.js +2 -0
  637. package/dist/modules/string.js.map +1 -0
  638. package/dist/modules/vector.esm.js +2 -0
  639. package/dist/modules/vector.esm.js.map +1 -0
  640. package/dist/modules/vector.js +2 -0
  641. package/dist/modules/vector.js.map +1 -0
  642. package/dist/reference/api.d.ts +75 -0
  643. package/dist/reference/datatype.d.ts +3 -0
  644. package/dist/reference/effect.d.ts +3 -0
  645. package/dist/reference/index.d.ts +191 -0
  646. package/dist/reference/shorthand.d.ts +3 -0
  647. package/dist/src/AutoCompleter/AutoCompleter.d.ts +25 -0
  648. package/dist/src/Dvala/Cache.d.ts +16 -0
  649. package/dist/src/Dvala/Dvala.d.ts +68 -0
  650. package/dist/src/allModules.d.ts +2 -0
  651. package/dist/src/builtin/bindingNode.d.ts +11 -0
  652. package/dist/src/builtin/core/array.d.ts +2 -0
  653. package/dist/src/builtin/core/assertion.d.ts +2 -0
  654. package/dist/src/builtin/core/bitwise.d.ts +2 -0
  655. package/dist/src/builtin/core/collection.d.ts +2 -0
  656. package/dist/src/builtin/core/functional.d.ts +2 -0
  657. package/dist/src/builtin/core/math.d.ts +2 -0
  658. package/dist/src/builtin/core/meta.d.ts +3 -0
  659. package/dist/src/builtin/core/misc.d.ts +2 -0
  660. package/dist/src/builtin/core/object.d.ts +2 -0
  661. package/dist/src/builtin/core/predicates.d.ts +2 -0
  662. package/dist/src/builtin/core/regexp.d.ts +2 -0
  663. package/dist/src/builtin/core/sequence.d.ts +2 -0
  664. package/dist/src/builtin/core/string.d.ts +2 -0
  665. package/dist/src/builtin/core/vector.d.ts +2 -0
  666. package/dist/src/builtin/index.d.ts +13 -0
  667. package/dist/src/builtin/interface.d.ts +113 -0
  668. package/dist/src/builtin/modules/assertion/docs.d.ts +2 -0
  669. package/dist/src/builtin/modules/assertion/index.d.ts +2 -0
  670. package/dist/src/builtin/modules/bitwise/index.d.ts +2 -0
  671. package/dist/src/builtin/modules/collection/index.d.ts +2 -0
  672. package/dist/src/builtin/modules/convert/index.d.ts +2 -0
  673. package/dist/src/builtin/modules/functional/index.d.ts +2 -0
  674. package/dist/src/builtin/modules/grid/docs.d.ts +2 -0
  675. package/dist/src/builtin/modules/grid/fromArray.d.ts +8 -0
  676. package/dist/src/builtin/modules/grid/index.d.ts +2 -0
  677. package/dist/src/builtin/modules/grid/transpose.d.ts +2 -0
  678. package/dist/src/builtin/modules/interface.d.ts +11 -0
  679. package/dist/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
  680. package/dist/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
  681. package/dist/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
  682. package/dist/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
  683. package/dist/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
  684. package/dist/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
  685. package/dist/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
  686. package/dist/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
  687. package/dist/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
  688. package/dist/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
  689. package/dist/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
  690. package/dist/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
  691. package/dist/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
  692. package/dist/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
  693. package/dist/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
  694. package/dist/src/builtin/modules/linear-algebra/index.d.ts +4 -0
  695. package/dist/src/builtin/modules/math/index.d.ts +2 -0
  696. package/dist/src/builtin/modules/matrix/docs.d.ts +2 -0
  697. package/dist/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
  698. package/dist/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
  699. package/dist/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
  700. package/dist/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
  701. package/dist/src/builtin/modules/matrix/helpers/diagonal.d.ts +1 -0
  702. package/dist/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
  703. package/dist/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
  704. package/dist/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
  705. package/dist/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
  706. package/dist/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
  707. package/dist/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
  708. package/dist/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
  709. package/dist/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
  710. package/dist/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
  711. package/dist/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
  712. package/dist/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
  713. package/dist/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
  714. package/dist/src/builtin/modules/matrix/index.d.ts +4 -0
  715. package/dist/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
  716. package/dist/src/builtin/modules/number-theory/combinations.d.ts +2 -0
  717. package/dist/src/builtin/modules/number-theory/derangements.d.ts +2 -0
  718. package/dist/src/builtin/modules/number-theory/divisors.d.ts +4 -0
  719. package/dist/src/builtin/modules/number-theory/docs.d.ts +2 -0
  720. package/dist/src/builtin/modules/number-theory/factorial.d.ts +3 -0
  721. package/dist/src/builtin/modules/number-theory/index.d.ts +4 -0
  722. package/dist/src/builtin/modules/number-theory/partitions.d.ts +2 -0
  723. package/dist/src/builtin/modules/number-theory/permutations.d.ts +2 -0
  724. package/dist/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
  725. package/dist/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
  726. package/dist/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
  727. package/dist/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
  728. package/dist/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
  729. package/dist/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
  730. package/dist/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
  731. package/dist/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
  732. package/dist/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
  733. package/dist/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
  734. package/dist/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
  735. package/dist/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
  736. package/dist/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
  737. package/dist/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
  738. package/dist/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
  739. package/dist/src/builtin/modules/number-theory/sequences/index.d.ts +27 -0
  740. package/dist/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
  741. package/dist/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
  742. package/dist/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
  743. package/dist/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
  744. package/dist/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
  745. package/dist/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
  746. package/dist/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
  747. package/dist/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
  748. package/dist/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
  749. package/dist/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
  750. package/dist/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
  751. package/dist/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
  752. package/dist/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
  753. package/dist/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
  754. package/dist/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
  755. package/dist/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
  756. package/dist/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
  757. package/dist/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
  758. package/dist/src/builtin/modules/random/docs.d.ts +2 -0
  759. package/dist/src/builtin/modules/random/index.d.ts +2 -0
  760. package/dist/src/builtin/modules/sequence/index.d.ts +2 -0
  761. package/dist/src/builtin/modules/string/index.d.ts +2 -0
  762. package/dist/src/builtin/modules/vector/bincount.d.ts +9 -0
  763. package/dist/src/builtin/modules/vector/calcMad.d.ts +1 -0
  764. package/dist/src/builtin/modules/vector/calcMean.d.ts +1 -0
  765. package/dist/src/builtin/modules/vector/calcMedad.d.ts +1 -0
  766. package/dist/src/builtin/modules/vector/calcMedian.d.ts +1 -0
  767. package/dist/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
  768. package/dist/src/builtin/modules/vector/calcVariance.d.ts +2 -0
  769. package/dist/src/builtin/modules/vector/docs.d.ts +2 -0
  770. package/dist/src/builtin/modules/vector/entropy.d.ts +8 -0
  771. package/dist/src/builtin/modules/vector/histogram.d.ts +9 -0
  772. package/dist/src/builtin/modules/vector/index.d.ts +2 -0
  773. package/dist/src/builtin/modules/vector/mode.d.ts +6 -0
  774. package/dist/src/builtin/modules/vector/outliers.d.ts +7 -0
  775. package/dist/src/builtin/modules/vector/percentile.d.ts +7 -0
  776. package/dist/src/builtin/modules/vector/quartiles.d.ts +1 -0
  777. package/dist/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
  778. package/dist/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
  779. package/dist/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
  780. package/dist/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
  781. package/dist/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
  782. package/dist/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
  783. package/dist/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
  784. package/dist/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
  785. package/dist/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
  786. package/dist/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
  787. package/dist/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
  788. package/dist/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
  789. package/dist/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
  790. package/dist/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
  791. package/dist/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
  792. package/dist/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
  793. package/dist/src/builtin/normalExpressions/index.d.ts +8 -0
  794. package/dist/src/builtin/specialExpressionTypes.d.ts +26 -0
  795. package/dist/src/builtin/specialExpressions/and.d.ts +6 -0
  796. package/dist/src/builtin/specialExpressions/array.d.ts +6 -0
  797. package/dist/src/builtin/specialExpressions/block.d.ts +6 -0
  798. package/dist/src/builtin/specialExpressions/cond.d.ts +6 -0
  799. package/dist/src/builtin/specialExpressions/defined.d.ts +5 -0
  800. package/dist/src/builtin/specialExpressions/effect.d.ts +5 -0
  801. package/dist/src/builtin/specialExpressions/functions.d.ts +6 -0
  802. package/dist/src/builtin/specialExpressions/if.d.ts +6 -0
  803. package/dist/src/builtin/specialExpressions/import.d.ts +6 -0
  804. package/dist/src/builtin/specialExpressions/let.d.ts +6 -0
  805. package/dist/src/builtin/specialExpressions/loop.d.ts +6 -0
  806. package/dist/src/builtin/specialExpressions/loops.d.ts +9 -0
  807. package/dist/src/builtin/specialExpressions/match.d.ts +7 -0
  808. package/dist/src/builtin/specialExpressions/object.d.ts +6 -0
  809. package/dist/src/builtin/specialExpressions/or.d.ts +6 -0
  810. package/dist/src/builtin/specialExpressions/parallel.d.ts +6 -0
  811. package/dist/src/builtin/specialExpressions/perform.d.ts +6 -0
  812. package/dist/src/builtin/specialExpressions/qq.d.ts +6 -0
  813. package/dist/src/builtin/specialExpressions/race.d.ts +6 -0
  814. package/dist/src/builtin/specialExpressions/recur.d.ts +5 -0
  815. package/dist/src/builtin/specialExpressions/throw.d.ts +5 -0
  816. package/dist/src/builtin/specialExpressions/try.d.ts +7 -0
  817. package/dist/src/builtin/specialExpressions/unless.d.ts +6 -0
  818. package/dist/src/builtin/utils.d.ts +6 -0
  819. package/dist/src/bundler/index.d.ts +9 -0
  820. package/dist/src/bundler/interface.d.ts +15 -0
  821. package/dist/src/bundler.d.ts +3 -0
  822. package/dist/src/constants/constants.d.ts +19 -0
  823. package/dist/src/debug.d.ts +115 -0
  824. package/dist/src/effects.d.ts +106 -0
  825. package/dist/src/errors.d.ts +24 -0
  826. package/dist/src/evaluator/ContextStack.d.ts +65 -0
  827. package/dist/src/evaluator/effectRef.d.ts +27 -0
  828. package/dist/src/evaluator/effectTypes.d.ts +79 -0
  829. package/dist/src/evaluator/frames.d.ts +525 -0
  830. package/dist/src/evaluator/interface.d.ts +14 -0
  831. package/dist/src/evaluator/serialization.d.ts +45 -0
  832. package/dist/src/evaluator/standardEffects.d.ts +35 -0
  833. package/dist/src/evaluator/step.d.ts +159 -0
  834. package/dist/src/evaluator/suspension.d.ts +53 -0
  835. package/dist/src/evaluator/trampoline.d.ts +119 -0
  836. package/dist/src/full.d.ts +17 -0
  837. package/dist/src/getUndefinedSymbols/index.d.ts +7 -0
  838. package/dist/src/index.d.ts +18 -0
  839. package/dist/src/initReferenceData.d.ts +1 -0
  840. package/dist/src/interface.d.ts +7 -0
  841. package/dist/src/modules/assertion.d.ts +2 -0
  842. package/dist/src/modules/bitwise.d.ts +2 -0
  843. package/dist/src/modules/collection.d.ts +2 -0
  844. package/dist/src/modules/convert.d.ts +2 -0
  845. package/dist/src/modules/functional.d.ts +2 -0
  846. package/dist/src/modules/grid.d.ts +2 -0
  847. package/dist/src/modules/linear-algebra.d.ts +2 -0
  848. package/dist/src/modules/math.d.ts +2 -0
  849. package/dist/src/modules/matrix.d.ts +2 -0
  850. package/dist/src/modules/number-theory.d.ts +2 -0
  851. package/dist/src/modules/random.d.ts +2 -0
  852. package/dist/src/modules/sequence.d.ts +2 -0
  853. package/dist/src/modules/string.d.ts +2 -0
  854. package/dist/src/modules/vector.d.ts +2 -0
  855. package/dist/src/parser/ParserContext.d.ts +20 -0
  856. package/dist/src/parser/getPrecedence.d.ts +3 -0
  857. package/dist/src/parser/helpers.d.ts +19 -0
  858. package/dist/src/parser/index.d.ts +5 -0
  859. package/dist/src/parser/subParsers/parseArray.d.ts +3 -0
  860. package/dist/src/parser/subParsers/parseBindingTarget.d.ts +8 -0
  861. package/dist/src/parser/subParsers/parseCond.d.ts +4 -0
  862. package/dist/src/parser/subParsers/parseDo.d.ts +3 -0
  863. package/dist/src/parser/subParsers/parseExpression.d.ts +5 -0
  864. package/dist/src/parser/subParsers/parseForOrDoseq.d.ts +4 -0
  865. package/dist/src/parser/subParsers/parseFunction.d.ts +4 -0
  866. package/dist/src/parser/subParsers/parseFunctionCall.d.ts +3 -0
  867. package/dist/src/parser/subParsers/parseIfOrUnless.d.ts +5 -0
  868. package/dist/src/parser/subParsers/parseImplicitBlock.d.ts +5 -0
  869. package/dist/src/parser/subParsers/parseLet.d.ts +4 -0
  870. package/dist/src/parser/subParsers/parseLoop.d.ts +4 -0
  871. package/dist/src/parser/subParsers/parseMatch.d.ts +4 -0
  872. package/dist/src/parser/subParsers/parseNumber.d.ts +3 -0
  873. package/dist/src/parser/subParsers/parseObject.d.ts +3 -0
  874. package/dist/src/parser/subParsers/parseOperand.d.ts +3 -0
  875. package/dist/src/parser/subParsers/parseRegexpShorthand.d.ts +3 -0
  876. package/dist/src/parser/subParsers/parseReservedSymbol.d.ts +3 -0
  877. package/dist/src/parser/subParsers/parseString.d.ts +4 -0
  878. package/dist/src/parser/subParsers/parseSymbol.d.ts +3 -0
  879. package/dist/src/parser/subParsers/parseTry.d.ts +4 -0
  880. package/dist/src/parser/types.d.ts +129 -0
  881. package/dist/src/symbolPatterns.d.ts +2 -0
  882. package/dist/src/testFramework/index.d.ts +15 -0
  883. package/dist/src/tokenizer/minifyTokenStream.d.ts +4 -0
  884. package/dist/src/tokenizer/operators.d.ts +12 -0
  885. package/dist/src/tokenizer/reservedNames.d.ts +66 -0
  886. package/dist/src/tokenizer/token.d.ts +84 -0
  887. package/dist/src/tokenizer/tokenize.d.ts +8 -0
  888. package/dist/src/tokenizer/tokenizers.d.ts +14 -0
  889. package/dist/src/transformer/index.d.ts +2 -0
  890. package/dist/src/typeGuards/annotatedArrays.d.ts +16 -0
  891. package/dist/src/typeGuards/array.d.ts +9 -0
  892. package/dist/src/typeGuards/astNode.d.ts +19 -0
  893. package/dist/src/typeGuards/dvala.d.ts +26 -0
  894. package/dist/src/typeGuards/dvalaFunction.d.ts +12 -0
  895. package/dist/src/typeGuards/index.d.ts +7 -0
  896. package/dist/src/typeGuards/number.d.ts +66 -0
  897. package/dist/src/typeGuards/string.d.ts +15 -0
  898. package/dist/src/untokenizer/index.d.ts +2 -0
  899. package/dist/src/utils/arity.d.ts +10 -0
  900. package/dist/src/utils/debug/debugTools.d.ts +1 -0
  901. package/dist/src/utils/debug/getCodeMarker.d.ts +2 -0
  902. package/dist/src/utils/debug/getSourceCodeInfo.d.ts +2 -0
  903. package/dist/src/utils/docString/generateDocString.d.ts +2 -0
  904. package/dist/src/utils/getAssertionError.d.ts +3 -0
  905. package/dist/src/utils/index.d.ts +14 -0
  906. package/dist/src/utils/maybePromise.d.ts +54 -0
  907. package/dist/src/utils/symbols.d.ts +3 -0
  908. package/dist/testFramework.esm.js +2 -0
  909. package/dist/testFramework.esm.js.map +1 -0
  910. package/dist/testFramework.js +2 -0
  911. package/dist/testFramework.js.map +1 -0
  912. package/package.json +144 -16
  913. package/dist/index.d.ts +0 -2
  914. package/dist/index.d.ts.map +0 -1
@@ -0,0 +1,2 @@
1
+ import type { TokenStream } from '../tokenizer/tokenize';
2
+ export declare function untokenize(tokenStream: TokenStream): string;
@@ -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,2 @@
1
+ import type { SourceCodeInfo } from '../../tokenizer/token';
2
+ export declare function getCodeMarker(sourceCodeInfo: SourceCodeInfo): string;
@@ -0,0 +1,2 @@
1
+ import type { SourceCodeInfo } from '../../tokenizer/token';
2
+ export declare function getSourceCodeInfo(anyValue: any, sourceCodeInfo: SourceCodeInfo | undefined): SourceCodeInfo | undefined;
@@ -0,0 +1,2 @@
1
+ import type { FunctionReference } from '../../../reference';
2
+ export declare function generateDocString(reference: FunctionReference): string;
@@ -0,0 +1,3 @@
1
+ import { DvalaError } from '../errors';
2
+ import type { SourceCodeInfo } from '../tokenizer/token';
3
+ export declare function getAssertionError(typeName: string, value: unknown, sourceCodeInfo?: SourceCodeInfo): DvalaError;
@@ -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,54 @@
1
+ /**
2
+ * MaybePromise utilities for transparent async support.
3
+ *
4
+ * The sync path stays zero-overhead — when no async JS functions are involved,
5
+ * everything runs synchronously with only `instanceof Promise` checks as overhead.
6
+ * When an async value is detected, the evaluation chain switches to Promise-based
7
+ * execution for the remainder.
8
+ */
9
+ export type MaybePromise<T> = T | Promise<T>;
10
+ /**
11
+ * Chain a value that might be a Promise. If the value is sync, calls fn synchronously.
12
+ * If it's a Promise, chains with .then().
13
+ */
14
+ export declare function chain<T, U>(value: MaybePromise<T>, fn: (v: T) => MaybePromise<U>): MaybePromise<U>;
15
+ /**
16
+ * Like Array.map but handles MaybePromise callbacks sequentially.
17
+ * In the sync case, runs as a simple loop. Switches to async only when needed.
18
+ */
19
+ export declare function mapSequential<T, U>(arr: readonly T[], fn: (elem: T, index: number) => MaybePromise<U>): MaybePromise<U[]>;
20
+ /**
21
+ * Like Array.reduce but handles MaybePromise callbacks sequentially.
22
+ * In the sync case, runs as a simple loop. Switches to async only when needed.
23
+ */
24
+ export declare function reduceSequential<T, U>(arr: readonly T[], fn: (acc: U, elem: T, index: number) => MaybePromise<U>, initial: U): MaybePromise<U>;
25
+ /**
26
+ * Like Array.forEach but handles MaybePromise callbacks sequentially.
27
+ * In the sync case, runs as a simple loop. Switches to async only when needed.
28
+ */
29
+ export declare function forEachSequential<T>(arr: readonly T[], fn: (elem: T, index: number) => MaybePromise<void>): MaybePromise<void>;
30
+ /**
31
+ * Try/catch that handles MaybePromise values correctly.
32
+ * If tryFn returns a Promise, catches both sync throws and Promise rejections.
33
+ */
34
+ export declare function tryCatch<T>(tryFn: () => MaybePromise<T>, catchFn: (error: unknown) => MaybePromise<T>): MaybePromise<T>;
35
+ /**
36
+ * Like Array.some but handles MaybePromise callbacks sequentially.
37
+ * Returns the first truthy MaybePromise result, or false.
38
+ */
39
+ export declare function someSequential<T>(arr: readonly T[], fn: (elem: T, index: number) => MaybePromise<unknown>): MaybePromise<boolean>;
40
+ /**
41
+ * Like Array.every but handles MaybePromise callbacks sequentially.
42
+ * Returns false as soon as a falsy result is found.
43
+ */
44
+ export declare function everySequential<T>(arr: readonly T[], fn: (elem: T, index: number) => MaybePromise<unknown>): MaybePromise<boolean>;
45
+ /**
46
+ * Like Array.filter but handles MaybePromise callbacks sequentially.
47
+ * Returns the filtered array.
48
+ */
49
+ export declare function filterSequential<T>(arr: readonly T[], fn: (elem: T, index: number) => MaybePromise<unknown>): MaybePromise<T[]>;
50
+ /**
51
+ * Like Array.findIndex but handles MaybePromise callbacks sequentially.
52
+ * Returns -1 if no element matches.
53
+ */
54
+ export declare function findIndexSequential<T>(arr: readonly T[], fn: (elem: T, index: number) => MaybePromise<unknown>): MaybePromise<number>;
@@ -0,0 +1,3 @@
1
+ export declare const FUNCTION_SYMBOL = "^^fn^^";
2
+ export declare const REGEXP_SYMBOL = "^^re^^";
3
+ export declare const EFFECT_SYMBOL = "^^ef^^";
@@ -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="DvalaError"}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);\n"*" string-repeat 10','let { string-repeat } = import(string);\nstring-repeat("*", 10)','let { string-repeat } = import(string);\nstring-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);\nfrom-char-code(65)","let { from-char-code } = import(string);\nfrom-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);\nto-char-code("A")','let { to-char-code } = import(string);\nto-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);\ntrim-left(" Albert ")','let { trim-left } = import(string);\ntrim-left(" ")','let { trim-left } = import(string);\ntrim-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);\ntrim-right(" Albert ")','let { trim-right } = import(string);\ntrim-right(" ")','let { trim-right } = import(string);\ntrim-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);\nsplit-lines("Albert\nMojir\n")','let { split-lines } = import(string);\nsplit-lines("Albert\n\nMojir")','let { split-lines } = import(string);\nsplit-lines("Albert\nMojir\n\n")','let { split-lines } = import(string);\nsplit-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);\n"Albert" pad-left 20','let { pad-left } = import(string);\npad-left("Albert", 20)','let { pad-left } = import(string);\npad-left("Albert", 20, "-*-")','let { pad-left } = import(string);\npad-left("Albert", 5)','let { pad-left } = import(string);\npad-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);\n"Albert" pad-right 20','let { pad-right } = import(string);\npad-right("Albert", 20)','let { pad-right } = import(string);\npad-right("Albert", 20, "-*-")','let { pad-right } = import(string);\npad-right("Albert", 5)','let { pad-right } = import(string);\npad-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);\ntemplate("Hi, $1 and $2", "Carl", "Larry")','let { template } = import(string);\ntemplate("Hi $1, $2, $3, $4, $5, $6, $7, $8 and $9", "A", "B", "C", "D", "E", "F", "G", "H", "I")','let { template } = import(string);\ntemplate("$1 book||||$1 books", 0)','let { template } = import(string);\ntemplate("$1 book||||$1 books", 1)','let { template } = import(string);\ntemplate("$1 book||||$1 books", 2)','let { template } = import(string);\ntemplate("No book||||$1 book||||$1 books", 0)','let { template } = import(string);\ntemplate("No book||||$1 book||||$1 books", 1)','let { template } = import(string);\ntemplate("No book||||$1 book||||$1 books", 10)','let { template } = import(string);\ntemplate("No book||||One book||||Two books||||Three books||||$1 books", 0)','let { template } = import(string);\ntemplate("No book||||One book||||Two books||||Three books||||$1 books", 1)','let { template } = import(string);\ntemplate("No book||||One book||||Two books||||Three books||||$1 books", 2)','let { template } = import(string);\ntemplate("No book||||One book||||Two books||||Three books||||$1 books", 3)','let { template } = import(string);\ntemplate("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);\nencode-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);\ndecode-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);\nencode-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);\ndecode-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);\ncapitalize("albert")','let { capitalize } = import(string);\ncapitalize("ALBERT")','let { capitalize } = import(string);\ncapitalize("aLBERT")','let { capitalize } = import(string);\ncapitalize("")']}}},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 getDvalaErrorMessage(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 DvalaError 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(getDvalaErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, DvalaError.prototype)\n this.name = 'DvalaError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends DvalaError {\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 DvalaError {\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 DvalaError {\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 isDvalaError(error: unknown): error is DvalaError {\n return error instanceof DvalaError\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 { AstNode, DvalaFunction } from '../../parser/types'\nimport { FUNCTION_SYMBOL } from '../symbols'\n\nfunction isDvalaFunction(func: unknown): func is DvalaFunction {\n if (func === null || typeof func !== 'object')\n return false\n\n return FUNCTION_SYMBOL in func && 'functionType' in func && isFunctionType(func.functionType)\n}\n\nfunction isNode(value: unknown): value is AstNode {\n if (!Array.isArray(value) || value.length < 2)\n return false\n return isNodeType(value[0])\n}\n\nexport function valueToString(value: unknown): string {\n if (isDvalaFunction(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^^'\nexport const EFFECT_SYMBOL = '^^ef^^'\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 { DvalaError } 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\nfunction 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 DvalaError('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 DvalaError(\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 { DvalaError } 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): DvalaError {\n return new DvalaError(`Expected ${typeName}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo))\n}\n","import { DvalaError } 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 DvalaError(\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 { DvalaError } from '../errors'\nimport type { FunctionLike } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isColl } from '../typeGuards/dvala'\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 DvalaError(\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 DvalaError(\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 { DvalaError } 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 { DvalaModule } 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);\n\"*\" string-repeat 10`,\n `let { string-repeat } = import(string);\nstring-repeat(\"*\", 10)`,\n `let { string-repeat } = import(string);\nstring-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 DvalaError(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);\nfrom-char-code(65)`,\n `let { from-char-code } = import(string);\nfrom-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);\nto-char-code(\"A\")`,\n `let { to-char-code } = import(string);\nto-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);\ntrim-left(\" Albert \")`,\n `let { trim-left } = import(string);\ntrim-left(\" \")`,\n `let { trim-left } = import(string);\ntrim-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);\ntrim-right(\" Albert \")`,\n `let { trim-right } = import(string);\ntrim-right(\" \")`,\n `let { trim-right } = import(string);\ntrim-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);\nsplit-lines(\"Albert\\nMojir\\n\")`,\n `let { split-lines } = import(string);\nsplit-lines(\"Albert\\n\\nMojir\")`,\n `let { split-lines } = import(string);\nsplit-lines(\"Albert\\nMojir\\n\\n\")`,\n `let { split-lines } = import(string);\nsplit-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);\n\"Albert\" pad-left 20`,\n `let { pad-left } = import(string);\npad-left(\"Albert\", 20)`,\n `let { pad-left } = import(string);\npad-left(\"Albert\", 20, \"-*-\")`,\n `let { pad-left } = import(string);\npad-left(\"Albert\", 5)`,\n `let { pad-left } = import(string);\npad-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);\n\"Albert\" pad-right 20`,\n `let { pad-right } = import(string);\npad-right(\"Albert\", 20)`,\n `let { pad-right } = import(string);\npad-right(\"Albert\", 20, \"-*-\")`,\n `let { pad-right } = import(string);\npad-right(\"Albert\", 5)`,\n `let { pad-right } = import(string);\npad-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);\ntemplate(\"Hi, $1 and $2\", \"Carl\", \"Larry\")`,\n `let { template } = import(string);\ntemplate(\"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);\ntemplate(\"$1 book||||$1 books\", 0)`,\n `let { template } = import(string);\ntemplate(\"$1 book||||$1 books\", 1)`,\n `let { template } = import(string);\ntemplate(\"$1 book||||$1 books\", 2)`,\n `let { template } = import(string);\ntemplate(\"No book||||$1 book||||$1 books\", 0)`,\n `let { template } = import(string);\ntemplate(\"No book||||$1 book||||$1 books\", 1)`,\n `let { template } = import(string);\ntemplate(\"No book||||$1 book||||$1 books\", 10)`,\n `let { template } = import(string);\ntemplate(\"No book||||One book||||Two books||||Three books||||$1 books\", 0)`,\n `let { template } = import(string);\ntemplate(\"No book||||One book||||Two books||||Three books||||$1 books\", 1)`,\n `let { template } = import(string);\ntemplate(\"No book||||One book||||Two books||||Three books||||$1 books\", 2)`,\n `let { template } = import(string);\ntemplate(\"No book||||One book||||Two books||||Three books||||$1 books\", 3)`,\n `let { template } = import(string);\ntemplate(\"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);\nencode-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 DvalaError(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);\ndecode-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);\nencode-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 DvalaError(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);\ndecode-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);\ncapitalize(\"albert\")`,\n `let { capitalize } = import(string);\ncapitalize(\"ALBERT\")`,\n `let { capitalize } = import(string);\ncapitalize(\"aLBERT\")`,\n `let { capitalize } = import(string);\ncapitalize(\"\")`,\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: DvalaModule = {\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/dvala'\nimport { isNumber } from '../typeGuards/number'\nimport { asString, assertStringOrNumber } from '../typeGuards/string'\nimport { isUnknownRecord } from '../typeGuards'\nimport { DvalaError } 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 DvalaError(`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","DvalaError","Error","shortMessage","constructor","err","message","super","location","line","filePath","getDvalaErrorMessage","this","Object","setPrototypeOf","prototype","name","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","functionTypeSet","isDvalaFunction","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,UAAmBC,MACdX,eACAY,aAChB,WAAAC,CAAYC,EAAcd,GACxB,MAAMe,EAAUD,aAAeH,MAC3BG,EAAIC,QACJ,GAAGD,IAEPE,MA/BJ,SAA8BD,EAAiBf,GAC7C,IAAKA,EACH,OAAOe,EAET,MAAME,EAAW,GAAGjB,EAAeC,SAASiB,QAAQlB,EAAeC,SAASG,SAM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AAWmH,EAAgB7H,EACtC,GAEHqG,MAAOD,EAAa,GACpBO,KAAM,CACJC,SAAU,SACVC,QAAS,CAAElE,KAAM,UACjBmE,KAAM,CAAEG,EAAG,CAAEtE,KAAM,WACnBwE,SAAU,CAAC,CAAEC,cAAe,CAAC,OAC7BC,YAAa,sCACbC,QAAS,CAAC,+BACVC,SAAU,CACR,8GAMNqC,WAAc,CACZpD,SAAU,EAAEC,GAAMzG,KAChB6F,EAAaY,EAAKzG,GACXyG,EAAIoD,OAAO,GAAGC,cAAgBrD,EAAImC,MAAM,GAAGmB,eAEpD1D,MAAOD,EAAa,GACpBO,KAAM,CACJC,SAAU,SACVC,QAAS,CAAElE,KAAM,UACjBmE,KAAM,CAAEG,EAAG,CAAEtE,KAAM,WACnBwE,SAAU,CAAC,CAAEC,cAAe,CAAC,OAC7BC,YAAa,wFACbC,QAAS,CAAC,aAAc,cACxBC,SAAU,CACR,6DAEA,6DAEA,6DAEA,2DAOFyC,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,EAAiC,CAC5C5I,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="DvalaError"}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);\n"*" string-repeat 10','let { string-repeat } = import(string);\nstring-repeat("*", 10)','let { string-repeat } = import(string);\nstring-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);\nfrom-char-code(65)","let { from-char-code } = import(string);\nfrom-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);\nto-char-code("A")','let { to-char-code } = import(string);\nto-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);\ntrim-left(" Albert ")','let { trim-left } = import(string);\ntrim-left(" ")','let { trim-left } = import(string);\ntrim-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);\ntrim-right(" Albert ")','let { trim-right } = import(string);\ntrim-right(" ")','let { trim-right } = import(string);\ntrim-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);\nsplit-lines("Albert\nMojir\n")','let { split-lines } = import(string);\nsplit-lines("Albert\n\nMojir")','let { split-lines } = import(string);\nsplit-lines("Albert\nMojir\n\n")','let { split-lines } = import(string);\nsplit-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);\n"Albert" pad-left 20','let { pad-left } = import(string);\npad-left("Albert", 20)','let { pad-left } = import(string);\npad-left("Albert", 20, "-*-")','let { pad-left } = import(string);\npad-left("Albert", 5)','let { pad-left } = import(string);\npad-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);\n"Albert" pad-right 20','let { pad-right } = import(string);\npad-right("Albert", 20)','let { pad-right } = import(string);\npad-right("Albert", 20, "-*-")','let { pad-right } = import(string);\npad-right("Albert", 5)','let { pad-right } = import(string);\npad-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);\ntemplate("Hi, $1 and $2", "Carl", "Larry")','let { template } = import(string);\ntemplate("Hi $1, $2, $3, $4, $5, $6, $7, $8 and $9", "A", "B", "C", "D", "E", "F", "G", "H", "I")','let { template } = import(string);\ntemplate("$1 book||||$1 books", 0)','let { template } = import(string);\ntemplate("$1 book||||$1 books", 1)','let { template } = import(string);\ntemplate("$1 book||||$1 books", 2)','let { template } = import(string);\ntemplate("No book||||$1 book||||$1 books", 0)','let { template } = import(string);\ntemplate("No book||||$1 book||||$1 books", 1)','let { template } = import(string);\ntemplate("No book||||$1 book||||$1 books", 10)','let { template } = import(string);\ntemplate("No book||||One book||||Two books||||Three books||||$1 books", 0)','let { template } = import(string);\ntemplate("No book||||One book||||Two books||||Three books||||$1 books", 1)','let { template } = import(string);\ntemplate("No book||||One book||||Two books||||Three books||||$1 books", 2)','let { template } = import(string);\ntemplate("No book||||One book||||Two books||||Three books||||$1 books", 3)','let { template } = import(string);\ntemplate("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);\nencode-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);\ndecode-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);\nencode-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);\ndecode-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);\ncapitalize("albert")','let { capitalize } = import(string);\ncapitalize("ALBERT")','let { capitalize } = import(string);\ncapitalize("aLBERT")','let { capitalize } = import(string);\ncapitalize("")']}}},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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.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 getDvalaErrorMessage(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 DvalaError 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(getDvalaErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, DvalaError.prototype)\n this.name = 'DvalaError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends DvalaError {\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 DvalaError {\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 DvalaError {\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 isDvalaError(error: unknown): error is DvalaError {\n return error instanceof DvalaError\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 { AstNode, DvalaFunction } from '../../parser/types'\nimport { FUNCTION_SYMBOL } from '../symbols'\n\nfunction isDvalaFunction(func: unknown): func is DvalaFunction {\n if (func === null || typeof func !== 'object')\n return false\n\n return FUNCTION_SYMBOL in func && 'functionType' in func && isFunctionType(func.functionType)\n}\n\nfunction isNode(value: unknown): value is AstNode {\n if (!Array.isArray(value) || value.length < 2)\n return false\n return isNodeType(value[0])\n}\n\nexport function valueToString(value: unknown): string {\n if (isDvalaFunction(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^^'\nexport const EFFECT_SYMBOL = '^^ef^^'\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 { DvalaError } 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\nfunction 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 DvalaError('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 DvalaError(\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 { DvalaError } 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): DvalaError {\n return new DvalaError(`Expected ${typeName}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo))\n}\n","import { DvalaError } 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 DvalaError(\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 { DvalaError } from '../errors'\nimport type { FunctionLike } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isColl } from '../typeGuards/dvala'\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 DvalaError(\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 DvalaError(\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 { DvalaError } 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 { DvalaModule } 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);\n\"*\" string-repeat 10`,\n `let { string-repeat } = import(string);\nstring-repeat(\"*\", 10)`,\n `let { string-repeat } = import(string);\nstring-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 DvalaError(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);\nfrom-char-code(65)`,\n `let { from-char-code } = import(string);\nfrom-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);\nto-char-code(\"A\")`,\n `let { to-char-code } = import(string);\nto-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);\ntrim-left(\" Albert \")`,\n `let { trim-left } = import(string);\ntrim-left(\" \")`,\n `let { trim-left } = import(string);\ntrim-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);\ntrim-right(\" Albert \")`,\n `let { trim-right } = import(string);\ntrim-right(\" \")`,\n `let { trim-right } = import(string);\ntrim-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);\nsplit-lines(\"Albert\\nMojir\\n\")`,\n `let { split-lines } = import(string);\nsplit-lines(\"Albert\\n\\nMojir\")`,\n `let { split-lines } = import(string);\nsplit-lines(\"Albert\\nMojir\\n\\n\")`,\n `let { split-lines } = import(string);\nsplit-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);\n\"Albert\" pad-left 20`,\n `let { pad-left } = import(string);\npad-left(\"Albert\", 20)`,\n `let { pad-left } = import(string);\npad-left(\"Albert\", 20, \"-*-\")`,\n `let { pad-left } = import(string);\npad-left(\"Albert\", 5)`,\n `let { pad-left } = import(string);\npad-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);\n\"Albert\" pad-right 20`,\n `let { pad-right } = import(string);\npad-right(\"Albert\", 20)`,\n `let { pad-right } = import(string);\npad-right(\"Albert\", 20, \"-*-\")`,\n `let { pad-right } = import(string);\npad-right(\"Albert\", 5)`,\n `let { pad-right } = import(string);\npad-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);\ntemplate(\"Hi, $1 and $2\", \"Carl\", \"Larry\")`,\n `let { template } = import(string);\ntemplate(\"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);\ntemplate(\"$1 book||||$1 books\", 0)`,\n `let { template } = import(string);\ntemplate(\"$1 book||||$1 books\", 1)`,\n `let { template } = import(string);\ntemplate(\"$1 book||||$1 books\", 2)`,\n `let { template } = import(string);\ntemplate(\"No book||||$1 book||||$1 books\", 0)`,\n `let { template } = import(string);\ntemplate(\"No book||||$1 book||||$1 books\", 1)`,\n `let { template } = import(string);\ntemplate(\"No book||||$1 book||||$1 books\", 10)`,\n `let { template } = import(string);\ntemplate(\"No book||||One book||||Two books||||Three books||||$1 books\", 0)`,\n `let { template } = import(string);\ntemplate(\"No book||||One book||||Two books||||Three books||||$1 books\", 1)`,\n `let { template } = import(string);\ntemplate(\"No book||||One book||||Two books||||Three books||||$1 books\", 2)`,\n `let { template } = import(string);\ntemplate(\"No book||||One book||||Two books||||Three books||||$1 books\", 3)`,\n `let { template } = import(string);\ntemplate(\"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);\nencode-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 DvalaError(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);\ndecode-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);\nencode-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 DvalaError(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);\ndecode-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);\ncapitalize(\"albert\")`,\n `let { capitalize } = import(string);\ncapitalize(\"ALBERT\")`,\n `let { capitalize } = import(string);\ncapitalize(\"aLBERT\")`,\n `let { capitalize } = import(string);\ncapitalize(\"\")`,\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: DvalaModule = {\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/dvala'\nimport { isNumber } from '../typeGuards/number'\nimport { asString, assertStringOrNumber } from '../typeGuards/string'\nimport { isUnknownRecord } from '../typeGuards'\nimport { DvalaError } 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 DvalaError(`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","DvalaError","Error","shortMessage","constructor","err","message","super","location","line","filePath","getDvalaErrorMessage","this","Object","setPrototypeOf","prototype","name","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","functionTypeSet","isDvalaFunction","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,UAAmBC,MACdX,eACAY,aAChB,WAAAC,CAAYC,EAAcd,GACxB,MAAMe,EAAUD,aAAeH,MAC3BG,EAAIC,QACJ,GAAGD,IAEPE,MA/BJ,SAA8BD,EAAiBf,GAC7C,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,CAAqBL,EAASf,IACpCqB,KAAKT,aAAeG,EACpBM,KAAKrB,eAAiBA,EACtBsB,OAAOC,eAAeF,KAAMX,EAAWc,WACvCH,KAAKI,KAAO,YACb,CAEM,aAAA1B,GACL,OAAOsB,KAAKrB,gBAAkBD,EAAcsB,KAAKrB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