@gridsheet/react-core 0.12.2 → 0.12.4-alpha.1

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 (382) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +5183 -11
  3. package/package.json +18 -3
  4. package/dist/components/Cell.d.ts +0 -8
  5. package/dist/components/Cell.d.ts.map +0 -1
  6. package/dist/components/Cell.js +0 -199
  7. package/dist/components/Cell.js.map +0 -1
  8. package/dist/components/ContextMenu.d.ts +0 -3
  9. package/dist/components/ContextMenu.d.ts.map +0 -1
  10. package/dist/components/ContextMenu.js +0 -207
  11. package/dist/components/ContextMenu.js.map +0 -1
  12. package/dist/components/Editor.d.ts +0 -3
  13. package/dist/components/Editor.d.ts.map +0 -1
  14. package/dist/components/Editor.js +0 -304
  15. package/dist/components/Editor.js.map +0 -1
  16. package/dist/components/Emitter.d.ts +0 -9
  17. package/dist/components/Emitter.d.ts.map +0 -1
  18. package/dist/components/Emitter.js +0 -26
  19. package/dist/components/Emitter.js.map +0 -1
  20. package/dist/components/GridSheet.d.ts +0 -4
  21. package/dist/components/GridSheet.d.ts.map +0 -1
  22. package/dist/components/GridSheet.js +0 -110
  23. package/dist/components/GridSheet.js.map +0 -1
  24. package/dist/components/HeaderLeftCell.d.ts +0 -7
  25. package/dist/components/HeaderLeftCell.d.ts.map +0 -1
  26. package/dist/components/HeaderLeftCell.js +0 -67
  27. package/dist/components/HeaderLeftCell.js.map +0 -1
  28. package/dist/components/HeaderTopCell.d.ts +0 -7
  29. package/dist/components/HeaderTopCell.d.ts.map +0 -1
  30. package/dist/components/HeaderTopCell.js +0 -68
  31. package/dist/components/HeaderTopCell.js.map +0 -1
  32. package/dist/components/Resizer.d.ts +0 -3
  33. package/dist/components/Resizer.d.ts.map +0 -1
  34. package/dist/components/Resizer.js +0 -83
  35. package/dist/components/Resizer.js.map +0 -1
  36. package/dist/components/SearchBox.d.ts +0 -3
  37. package/dist/components/SearchBox.d.ts.map +0 -1
  38. package/dist/components/SearchBox.js +0 -52
  39. package/dist/components/SearchBox.js.map +0 -1
  40. package/dist/components/StoreInitializer.d.ts +0 -4
  41. package/dist/components/StoreInitializer.d.ts.map +0 -1
  42. package/dist/components/StoreInitializer.js +0 -68
  43. package/dist/components/StoreInitializer.js.map +0 -1
  44. package/dist/components/Tabular.d.ts +0 -9
  45. package/dist/components/Tabular.d.ts.map +0 -1
  46. package/dist/components/Tabular.js +0 -84
  47. package/dist/components/Tabular.js.map +0 -1
  48. package/dist/constants.d.ts +0 -18
  49. package/dist/constants.d.ts.map +0 -1
  50. package/dist/constants.js +0 -21
  51. package/dist/constants.js.map +0 -1
  52. package/dist/formula/evaluator.d.ts +0 -91
  53. package/dist/formula/evaluator.d.ts.map +0 -1
  54. package/dist/formula/evaluator.js +0 -541
  55. package/dist/formula/evaluator.js.map +0 -1
  56. package/dist/formula/functions/__base.d.ts +0 -23
  57. package/dist/formula/functions/__base.d.ts.map +0 -1
  58. package/dist/formula/functions/__base.js +0 -16
  59. package/dist/formula/functions/__base.js.map +0 -1
  60. package/dist/formula/functions/__utils.d.ts +0 -6
  61. package/dist/formula/functions/__utils.d.ts.map +0 -1
  62. package/dist/formula/functions/__utils.js +0 -102
  63. package/dist/formula/functions/__utils.js.map +0 -1
  64. package/dist/formula/functions/abs.d.ts +0 -12
  65. package/dist/formula/functions/abs.d.ts.map +0 -1
  66. package/dist/formula/functions/abs.js +0 -21
  67. package/dist/formula/functions/abs.js.map +0 -1
  68. package/dist/formula/functions/abs.spec.d.ts +0 -2
  69. package/dist/formula/functions/abs.spec.d.ts.map +0 -1
  70. package/dist/formula/functions/abs.spec.js +0 -29
  71. package/dist/formula/functions/abs.spec.js.map +0 -1
  72. package/dist/formula/functions/acos.d.ts +0 -12
  73. package/dist/formula/functions/acos.d.ts.map +0 -1
  74. package/dist/formula/functions/acos.js +0 -29
  75. package/dist/formula/functions/acos.js.map +0 -1
  76. package/dist/formula/functions/add.d.ts +0 -13
  77. package/dist/formula/functions/add.d.ts.map +0 -1
  78. package/dist/formula/functions/add.js +0 -50
  79. package/dist/formula/functions/add.js.map +0 -1
  80. package/dist/formula/functions/and.d.ts +0 -19
  81. package/dist/formula/functions/and.d.ts.map +0 -1
  82. package/dist/formula/functions/and.js +0 -28
  83. package/dist/formula/functions/and.js.map +0 -1
  84. package/dist/formula/functions/asin.d.ts +0 -12
  85. package/dist/formula/functions/asin.d.ts.map +0 -1
  86. package/dist/formula/functions/asin.js +0 -29
  87. package/dist/formula/functions/asin.js.map +0 -1
  88. package/dist/formula/functions/atan.d.ts +0 -12
  89. package/dist/formula/functions/atan.d.ts.map +0 -1
  90. package/dist/formula/functions/atan.js +0 -26
  91. package/dist/formula/functions/atan.js.map +0 -1
  92. package/dist/formula/functions/atan2.d.ts +0 -12
  93. package/dist/formula/functions/atan2.d.ts.map +0 -1
  94. package/dist/formula/functions/atan2.js +0 -32
  95. package/dist/formula/functions/atan2.js.map +0 -1
  96. package/dist/formula/functions/average.d.ts +0 -19
  97. package/dist/formula/functions/average.d.ts.map +0 -1
  98. package/dist/formula/functions/average.js +0 -41
  99. package/dist/formula/functions/average.js.map +0 -1
  100. package/dist/formula/functions/col.d.ts +0 -14
  101. package/dist/formula/functions/col.d.ts.map +0 -1
  102. package/dist/formula/functions/col.js +0 -30
  103. package/dist/formula/functions/col.js.map +0 -1
  104. package/dist/formula/functions/concat.d.ts +0 -12
  105. package/dist/formula/functions/concat.d.ts.map +0 -1
  106. package/dist/formula/functions/concat.js +0 -27
  107. package/dist/formula/functions/concat.js.map +0 -1
  108. package/dist/formula/functions/concatenate.d.ts +0 -19
  109. package/dist/formula/functions/concatenate.d.ts.map +0 -1
  110. package/dist/formula/functions/concatenate.js +0 -25
  111. package/dist/formula/functions/concatenate.js.map +0 -1
  112. package/dist/formula/functions/cos.d.ts +0 -12
  113. package/dist/formula/functions/cos.d.ts.map +0 -1
  114. package/dist/formula/functions/cos.js +0 -26
  115. package/dist/formula/functions/cos.js.map +0 -1
  116. package/dist/formula/functions/count.d.ts +0 -19
  117. package/dist/formula/functions/count.d.ts.map +0 -1
  118. package/dist/formula/functions/count.js +0 -35
  119. package/dist/formula/functions/count.js.map +0 -1
  120. package/dist/formula/functions/counta.d.ts +0 -19
  121. package/dist/formula/functions/counta.d.ts.map +0 -1
  122. package/dist/formula/functions/counta.js +0 -35
  123. package/dist/formula/functions/counta.js.map +0 -1
  124. package/dist/formula/functions/countif.d.ts +0 -13
  125. package/dist/formula/functions/countif.d.ts.map +0 -1
  126. package/dist/formula/functions/countif.js +0 -30
  127. package/dist/formula/functions/countif.js.map +0 -1
  128. package/dist/formula/functions/divide.d.ts +0 -12
  129. package/dist/formula/functions/divide.d.ts.map +0 -1
  130. package/dist/formula/functions/divide.js +0 -33
  131. package/dist/formula/functions/divide.js.map +0 -1
  132. package/dist/formula/functions/eq.d.ts +0 -12
  133. package/dist/formula/functions/eq.d.ts.map +0 -1
  134. package/dist/formula/functions/eq.js +0 -25
  135. package/dist/formula/functions/eq.js.map +0 -1
  136. package/dist/formula/functions/exp.d.ts +0 -12
  137. package/dist/formula/functions/exp.d.ts.map +0 -1
  138. package/dist/formula/functions/exp.js +0 -28
  139. package/dist/formula/functions/exp.js.map +0 -1
  140. package/dist/formula/functions/gt.d.ts +0 -12
  141. package/dist/formula/functions/gt.d.ts.map +0 -1
  142. package/dist/formula/functions/gt.js +0 -27
  143. package/dist/formula/functions/gt.js.map +0 -1
  144. package/dist/formula/functions/gte.d.ts +0 -12
  145. package/dist/formula/functions/gte.d.ts.map +0 -1
  146. package/dist/formula/functions/gte.js +0 -27
  147. package/dist/formula/functions/gte.js.map +0 -1
  148. package/dist/formula/functions/hlookup.d.ts +0 -18
  149. package/dist/formula/functions/hlookup.d.ts.map +0 -1
  150. package/dist/formula/functions/hlookup.js +0 -74
  151. package/dist/formula/functions/hlookup.js.map +0 -1
  152. package/dist/formula/functions/if.d.ts +0 -17
  153. package/dist/formula/functions/if.d.ts.map +0 -1
  154. package/dist/formula/functions/if.js +0 -36
  155. package/dist/formula/functions/if.js.map +0 -1
  156. package/dist/formula/functions/iferror.d.ts +0 -20
  157. package/dist/formula/functions/iferror.d.ts.map +0 -1
  158. package/dist/formula/functions/iferror.js +0 -41
  159. package/dist/formula/functions/iferror.js.map +0 -1
  160. package/dist/formula/functions/iferror.spec.d.ts +0 -2
  161. package/dist/formula/functions/iferror.spec.d.ts.map +0 -1
  162. package/dist/formula/functions/iferror.spec.js +0 -61
  163. package/dist/formula/functions/iferror.spec.js.map +0 -1
  164. package/dist/formula/functions/len.d.ts +0 -12
  165. package/dist/formula/functions/len.d.ts.map +0 -1
  166. package/dist/formula/functions/len.js +0 -26
  167. package/dist/formula/functions/len.js.map +0 -1
  168. package/dist/formula/functions/lenb.d.ts +0 -12
  169. package/dist/formula/functions/lenb.d.ts.map +0 -1
  170. package/dist/formula/functions/lenb.js +0 -26
  171. package/dist/formula/functions/lenb.js.map +0 -1
  172. package/dist/formula/functions/ln.d.ts +0 -12
  173. package/dist/formula/functions/ln.d.ts.map +0 -1
  174. package/dist/formula/functions/ln.js +0 -29
  175. package/dist/formula/functions/ln.js.map +0 -1
  176. package/dist/formula/functions/log.d.ts +0 -12
  177. package/dist/formula/functions/log.d.ts.map +0 -1
  178. package/dist/formula/functions/log.js +0 -35
  179. package/dist/formula/functions/log.js.map +0 -1
  180. package/dist/formula/functions/log10.d.ts +0 -12
  181. package/dist/formula/functions/log10.d.ts.map +0 -1
  182. package/dist/formula/functions/log10.js +0 -29
  183. package/dist/formula/functions/log10.js.map +0 -1
  184. package/dist/formula/functions/lt.d.ts +0 -12
  185. package/dist/formula/functions/lt.d.ts.map +0 -1
  186. package/dist/formula/functions/lt.js +0 -27
  187. package/dist/formula/functions/lt.js.map +0 -1
  188. package/dist/formula/functions/lte.d.ts +0 -12
  189. package/dist/formula/functions/lte.d.ts.map +0 -1
  190. package/dist/formula/functions/lte.js +0 -27
  191. package/dist/formula/functions/lte.js.map +0 -1
  192. package/dist/formula/functions/max.d.ts +0 -19
  193. package/dist/formula/functions/max.d.ts.map +0 -1
  194. package/dist/formula/functions/max.js +0 -44
  195. package/dist/formula/functions/max.js.map +0 -1
  196. package/dist/formula/functions/min.d.ts +0 -19
  197. package/dist/formula/functions/min.d.ts.map +0 -1
  198. package/dist/formula/functions/min.js +0 -44
  199. package/dist/formula/functions/min.js.map +0 -1
  200. package/dist/formula/functions/minus.d.ts +0 -13
  201. package/dist/formula/functions/minus.d.ts.map +0 -1
  202. package/dist/formula/functions/minus.js +0 -50
  203. package/dist/formula/functions/minus.js.map +0 -1
  204. package/dist/formula/functions/mod.d.ts +0 -12
  205. package/dist/formula/functions/mod.d.ts.map +0 -1
  206. package/dist/formula/functions/mod.js +0 -31
  207. package/dist/formula/functions/mod.js.map +0 -1
  208. package/dist/formula/functions/mod.spec.d.ts +0 -2
  209. package/dist/formula/functions/mod.spec.d.ts.map +0 -1
  210. package/dist/formula/functions/mod.spec.js +0 -52
  211. package/dist/formula/functions/mod.spec.js.map +0 -1
  212. package/dist/formula/functions/multiply.d.ts +0 -12
  213. package/dist/formula/functions/multiply.d.ts.map +0 -1
  214. package/dist/formula/functions/multiply.js +0 -27
  215. package/dist/formula/functions/multiply.js.map +0 -1
  216. package/dist/formula/functions/ne.d.ts +0 -12
  217. package/dist/formula/functions/ne.d.ts.map +0 -1
  218. package/dist/formula/functions/ne.js +0 -25
  219. package/dist/formula/functions/ne.js.map +0 -1
  220. package/dist/formula/functions/not.d.ts +0 -12
  221. package/dist/formula/functions/not.d.ts.map +0 -1
  222. package/dist/formula/functions/not.js +0 -30
  223. package/dist/formula/functions/not.js.map +0 -1
  224. package/dist/formula/functions/now.d.ts +0 -9
  225. package/dist/formula/functions/now.d.ts.map +0 -1
  226. package/dist/formula/functions/now.js +0 -21
  227. package/dist/formula/functions/now.js.map +0 -1
  228. package/dist/formula/functions/or.d.ts +0 -19
  229. package/dist/formula/functions/or.d.ts.map +0 -1
  230. package/dist/formula/functions/or.js +0 -28
  231. package/dist/formula/functions/or.js.map +0 -1
  232. package/dist/formula/functions/pi.d.ts +0 -9
  233. package/dist/formula/functions/pi.d.ts.map +0 -1
  234. package/dist/formula/functions/pi.js +0 -19
  235. package/dist/formula/functions/pi.js.map +0 -1
  236. package/dist/formula/functions/power.d.ts +0 -12
  237. package/dist/formula/functions/power.d.ts.map +0 -1
  238. package/dist/formula/functions/power.js +0 -24
  239. package/dist/formula/functions/power.js.map +0 -1
  240. package/dist/formula/functions/product.d.ts +0 -19
  241. package/dist/formula/functions/product.d.ts.map +0 -1
  242. package/dist/formula/functions/product.js +0 -37
  243. package/dist/formula/functions/product.js.map +0 -1
  244. package/dist/formula/functions/radians.d.ts +0 -12
  245. package/dist/formula/functions/radians.d.ts.map +0 -1
  246. package/dist/formula/functions/radians.js +0 -26
  247. package/dist/formula/functions/radians.js.map +0 -1
  248. package/dist/formula/functions/rand.d.ts +0 -9
  249. package/dist/formula/functions/rand.d.ts.map +0 -1
  250. package/dist/formula/functions/rand.js +0 -19
  251. package/dist/formula/functions/rand.js.map +0 -1
  252. package/dist/formula/functions/round.d.ts +0 -17
  253. package/dist/formula/functions/round.d.ts.map +0 -1
  254. package/dist/formula/functions/round.js +0 -34
  255. package/dist/formula/functions/round.js.map +0 -1
  256. package/dist/formula/functions/rounddown.d.ts +0 -17
  257. package/dist/formula/functions/rounddown.d.ts.map +0 -1
  258. package/dist/formula/functions/rounddown.js +0 -34
  259. package/dist/formula/functions/rounddown.js.map +0 -1
  260. package/dist/formula/functions/roundup.d.ts +0 -17
  261. package/dist/formula/functions/roundup.d.ts.map +0 -1
  262. package/dist/formula/functions/roundup.js +0 -34
  263. package/dist/formula/functions/roundup.js.map +0 -1
  264. package/dist/formula/functions/row.d.ts +0 -14
  265. package/dist/formula/functions/row.d.ts.map +0 -1
  266. package/dist/formula/functions/row.js +0 -30
  267. package/dist/formula/functions/row.js.map +0 -1
  268. package/dist/formula/functions/sin.d.ts +0 -12
  269. package/dist/formula/functions/sin.d.ts.map +0 -1
  270. package/dist/formula/functions/sin.js +0 -26
  271. package/dist/formula/functions/sin.js.map +0 -1
  272. package/dist/formula/functions/sqrt.d.ts +0 -12
  273. package/dist/formula/functions/sqrt.d.ts.map +0 -1
  274. package/dist/formula/functions/sqrt.js +0 -29
  275. package/dist/formula/functions/sqrt.js.map +0 -1
  276. package/dist/formula/functions/sum.d.ts +0 -19
  277. package/dist/formula/functions/sum.d.ts.map +0 -1
  278. package/dist/formula/functions/sum.js +0 -44
  279. package/dist/formula/functions/sum.js.map +0 -1
  280. package/dist/formula/functions/sum.spec.d.ts +0 -2
  281. package/dist/formula/functions/sum.spec.d.ts.map +0 -1
  282. package/dist/formula/functions/sum.spec.js +0 -40
  283. package/dist/formula/functions/sum.spec.js.map +0 -1
  284. package/dist/formula/functions/sumif.d.ts +0 -18
  285. package/dist/formula/functions/sumif.d.ts.map +0 -1
  286. package/dist/formula/functions/sumif.js +0 -59
  287. package/dist/formula/functions/sumif.js.map +0 -1
  288. package/dist/formula/functions/tan.d.ts +0 -12
  289. package/dist/formula/functions/tan.d.ts.map +0 -1
  290. package/dist/formula/functions/tan.js +0 -26
  291. package/dist/formula/functions/tan.js.map +0 -1
  292. package/dist/formula/functions/uminus.d.ts +0 -12
  293. package/dist/formula/functions/uminus.d.ts.map +0 -1
  294. package/dist/formula/functions/uminus.js +0 -23
  295. package/dist/formula/functions/uminus.js.map +0 -1
  296. package/dist/formula/functions/vlookup.d.ts +0 -18
  297. package/dist/formula/functions/vlookup.d.ts.map +0 -1
  298. package/dist/formula/functions/vlookup.js +0 -74
  299. package/dist/formula/functions/vlookup.js.map +0 -1
  300. package/dist/formula/mapping.d.ts +0 -114
  301. package/dist/formula/mapping.d.ts.map +0 -1
  302. package/dist/formula/mapping.js +0 -114
  303. package/dist/formula/mapping.js.map +0 -1
  304. package/dist/formula/solver.d.ts +0 -12
  305. package/dist/formula/solver.d.ts.map +0 -1
  306. package/dist/formula/solver.js +0 -64
  307. package/dist/formula/solver.js.map +0 -1
  308. package/dist/index.d.ts +0 -12
  309. package/dist/index.d.ts.map +0 -1
  310. package/dist/index.js.map +0 -1
  311. package/dist/lib/autofill.d.ts +0 -17
  312. package/dist/lib/autofill.d.ts.map +0 -1
  313. package/dist/lib/autofill.js +0 -389
  314. package/dist/lib/autofill.js.map +0 -1
  315. package/dist/lib/clipboard.d.ts +0 -3
  316. package/dist/lib/clipboard.d.ts.map +0 -1
  317. package/dist/lib/clipboard.js +0 -45
  318. package/dist/lib/clipboard.js.map +0 -1
  319. package/dist/lib/converters.d.ts +0 -10
  320. package/dist/lib/converters.d.ts.map +0 -1
  321. package/dist/lib/converters.js +0 -127
  322. package/dist/lib/converters.js.map +0 -1
  323. package/dist/lib/structs.d.ts +0 -60
  324. package/dist/lib/structs.d.ts.map +0 -1
  325. package/dist/lib/structs.js +0 -251
  326. package/dist/lib/structs.js.map +0 -1
  327. package/dist/lib/table.d.ts +0 -299
  328. package/dist/lib/table.d.ts.map +0 -1
  329. package/dist/lib/table.js +0 -989
  330. package/dist/lib/table.js.map +0 -1
  331. package/dist/lib/time.d.ts +0 -14
  332. package/dist/lib/time.d.ts.map +0 -1
  333. package/dist/lib/time.js +0 -60
  334. package/dist/lib/time.js.map +0 -1
  335. package/dist/lib/virtualization.d.ts +0 -30
  336. package/dist/lib/virtualization.d.ts.map +0 -1
  337. package/dist/lib/virtualization.js +0 -114
  338. package/dist/lib/virtualization.js.map +0 -1
  339. package/dist/parsers/core.d.ts +0 -36
  340. package/dist/parsers/core.d.ts.map +0 -1
  341. package/dist/parsers/core.js +0 -123
  342. package/dist/parsers/core.js.map +0 -1
  343. package/dist/renderers/checkbox.d.ts +0 -5
  344. package/dist/renderers/checkbox.d.ts.map +0 -1
  345. package/dist/renderers/checkbox.js +0 -10
  346. package/dist/renderers/checkbox.js.map +0 -1
  347. package/dist/renderers/core.d.ts +0 -48
  348. package/dist/renderers/core.d.ts.map +0 -1
  349. package/dist/renderers/core.js +0 -143
  350. package/dist/renderers/core.js.map +0 -1
  351. package/dist/renderers/thousand_separator.d.ts +0 -5
  352. package/dist/renderers/thousand_separator.d.ts.map +0 -1
  353. package/dist/renderers/thousand_separator.js +0 -14
  354. package/dist/renderers/thousand_separator.js.map +0 -1
  355. package/dist/store/actions.d.ts +0 -198
  356. package/dist/store/actions.d.ts.map +0 -1
  357. package/dist/store/actions.js +0 -519
  358. package/dist/store/actions.js.map +0 -1
  359. package/dist/store/helpers.d.ts +0 -28
  360. package/dist/store/helpers.d.ts.map +0 -1
  361. package/dist/store/helpers.js +0 -78
  362. package/dist/store/helpers.js.map +0 -1
  363. package/dist/store/index.d.ts +0 -11
  364. package/dist/store/index.d.ts.map +0 -1
  365. package/dist/store/index.js +0 -3
  366. package/dist/store/index.js.map +0 -1
  367. package/dist/styles/embedder.d.ts +0 -2
  368. package/dist/styles/embedder.d.ts.map +0 -1
  369. package/dist/styles/embedder.js +0 -16
  370. package/dist/styles/embedder.js.map +0 -1
  371. package/dist/styles/minified.d.ts +0 -3
  372. package/dist/styles/minified.d.ts.map +0 -1
  373. package/dist/styles/minified.js +0 -4
  374. package/dist/styles/minified.js.map +0 -1
  375. package/dist/types.d.ts +0 -213
  376. package/dist/types.d.ts.map +0 -1
  377. package/dist/types.js +0 -2
  378. package/dist/types.js.map +0 -1
  379. package/dist/utils.d.ts +0 -2
  380. package/dist/utils.d.ts.map +0 -1
  381. package/dist/utils.js +0 -7
  382. package/dist/utils.js.map +0 -1
@@ -1,102 +0,0 @@
1
- import { solveTable } from "../solver";
2
- import { Table } from "../../lib/table";
3
- import { FormulaError } from "../evaluator";
4
- export const ensureNumber = (value, alternative) => {
5
- if (typeof value === "undefined" && typeof alternative !== "undefined") {
6
- return alternative;
7
- }
8
- if (!value) {
9
- // falsy is 0
10
- return 0;
11
- }
12
- if (value instanceof Table) {
13
- const v = stripTable(value, 0, 0);
14
- return ensureNumber(v, alternative);
15
- }
16
- const num = parseFloat(value);
17
- if (isNaN(num)) {
18
- throw new FormulaError("#VALUE!", `${value} cannot be converted to a number`);
19
- }
20
- return num;
21
- };
22
- export const ensureString = (value) => {
23
- if (!value) {
24
- return "";
25
- }
26
- if (value instanceof Table) {
27
- const v = stripTable(value, 0, 0);
28
- return ensureString(v);
29
- }
30
- switch (value.constructor.name) {
31
- case "Date":
32
- if (value.getHours() + value.getMinutes() + value.getSeconds() === 0) {
33
- return value.toLocaleDateString();
34
- }
35
- return value.toLocaleString();
36
- default:
37
- return String(value);
38
- }
39
- };
40
- export const ensureBoolean = (value, alternative) => {
41
- if (typeof value === "undefined" && typeof alternative !== "undefined") {
42
- return alternative;
43
- }
44
- if (value === null) {
45
- return false;
46
- }
47
- if (value instanceof Table) {
48
- const v = stripTable(value, 0, 0);
49
- return ensureBoolean(v, alternative);
50
- }
51
- if (typeof value === "string" || value instanceof String) {
52
- const bool = { true: true, false: false }[value.toLowerCase()];
53
- if (bool == null) {
54
- throw new FormulaError("#VALUE!", `text '${value}' cannot be converted to a boolean`);
55
- }
56
- return bool;
57
- }
58
- return Boolean(value);
59
- };
60
- export const stripTable = (value, y = 0, x = 0) => {
61
- if (value instanceof Table) {
62
- return solveTable({ table: value })[y][x];
63
- }
64
- return value;
65
- };
66
- const CONDITION_REGEX = /^(?<expr>|<=|>=|<>|>|<|=)?(?<target>.*)$/;
67
- export const check = (value, condition) => {
68
- const m = condition.match(CONDITION_REGEX);
69
- const { expr = "", target = "" } = m === null || m === void 0 ? void 0 : m.groups;
70
- const comparison = parseFloat(target);
71
- if (expr === ">" || expr === "<" || expr === ">=" || expr === "<=") {
72
- if (isNaN(comparison) === (typeof value === "number")) {
73
- return false;
74
- }
75
- switch (expr) {
76
- case ">":
77
- return value > target;
78
- case ">=":
79
- return value >= target;
80
- case "<":
81
- return value < target;
82
- case "<=":
83
- return value <= target;
84
- }
85
- }
86
- const equals = expr === "" || expr === "=";
87
- if (target === "") {
88
- return !value === equals;
89
- }
90
- if (isNaN(comparison) &&
91
- (typeof value === "string" || value instanceof String)) {
92
- const replaced = target
93
- .replace(/~\*/g, "(\\*)")
94
- .replace(/~\?/g, "(\\?)")
95
- .replace(/\*/g, "(.*)")
96
- .replace(/\?/g, "(.?)");
97
- const regex = RegExp(`^${replaced}$`, "i");
98
- return regex.test(value) === equals;
99
- }
100
- return (value == comparison) === equals;
101
- };
102
- //# sourceMappingURL=__utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"__utils.js","sourceRoot":"","sources":["../../../src/formula/functions/__utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAU,EAAE,WAAoB,EAAU,EAAE;IACvE,IAAI,OAAO,KAAK,KAAK,WAAW,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE;QACtE,OAAO,WAAW,CAAC;KACpB;IACD,IAAI,CAAC,KAAK,EAAE;QACV,aAAa;QACb,OAAO,CAAC,CAAC;KACV;IACD,IAAI,KAAK,YAAY,KAAK,EAAE;QAC1B,MAAM,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAClC,OAAO,YAAY,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;KACrC;IACD,MAAM,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC9B,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE;QACd,MAAM,IAAI,YAAY,CACpB,SAAS,EACT,GAAG,KAAK,kCAAkC,CAC3C,CAAC;KACH;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAU,EAAU,EAAE;IACjD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,EAAE,CAAC;KACX;IACD,IAAI,KAAK,YAAY,KAAK,EAAE;QAC1B,MAAM,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAClC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;KACxB;IACD,QAAQ,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE;QAC9B,KAAK,MAAM;YACT,IAAI,KAAK,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,UAAU,EAAE,GAAG,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE;gBACpE,OAAO,KAAK,CAAC,kBAAkB,EAAE,CAAC;aACnC;YACD,OAAO,KAAK,CAAC,cAAc,EAAE,CAAC;QAChC;YACE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;KACxB;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,KAAU,EAEV,WAAqB,EACZ,EAAE;IACX,IAAI,OAAO,KAAK,KAAK,WAAW,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE;QACtE,OAAO,WAAW,CAAC;KACpB;IACD,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,OAAO,KAAK,CAAC;KACd;IACD,IAAI,KAAK,YAAY,KAAK,EAAE;QAC1B,MAAM,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAClC,OAAO,aAAa,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;KACtC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QACxD,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;QAC/D,IAAI,IAAI,IAAI,IAAI,EAAE;YAChB,MAAM,IAAI,YAAY,CACpB,SAAS,EACT,SAAS,KAAK,oCAAoC,CACnD,CAAC;SACH;QACD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAU,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE;IACrD,IAAI,KAAK,YAAY,KAAK,EAAE;QAC1B,OAAO,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC3C;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,0CAA0C,CAAC;AAEnE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAU,EAAE,SAAiB,EAAE,EAAE;IACrD,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAC3C,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,MAAO,CAAC;IAE9C,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE;QAClE,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,EAAE;YACrD,OAAO,KAAK,CAAC;SACd;QACD,QAAQ,IAAI,EAAE;YACZ,KAAK,GAAG;gBACN,OAAO,KAAK,GAAG,MAAM,CAAC;YACxB,KAAK,IAAI;gBACP,OAAO,KAAK,IAAI,MAAM,CAAC;YACzB,KAAK,GAAG;gBACN,OAAO,KAAK,GAAG,MAAM,CAAC;YACxB,KAAK,IAAI;gBACP,OAAO,KAAK,IAAI,MAAM,CAAC;SAC1B;KACF;IAED,MAAM,MAAM,GAAG,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,GAAG,CAAC;IAC3C,IAAI,MAAM,KAAK,EAAE,EAAE;QACjB,OAAO,CAAC,KAAK,KAAK,MAAM,CAAC;KAC1B;IAED,IACE,KAAK,CAAC,UAAU,CAAC;QACjB,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC,EACtD;QACA,MAAM,QAAQ,GAAG,MAAM;aACpB,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC;aACxB,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC;aACxB,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;aACtB,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC1B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,QAAQ,GAAG,EAAE,GAAG,CAAC,CAAC;QAC3C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAe,CAAC,KAAK,MAAM,CAAC;KAC/C;IACD,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,MAAM,CAAC;AAC1C,CAAC,CAAC"}
@@ -1,12 +0,0 @@
1
- import { BaseFunction } from "./__base";
2
- export declare class AbsFunction extends BaseFunction {
3
- example: string;
4
- helpText: string[];
5
- helpArgs: {
6
- name: string;
7
- description: string;
8
- }[];
9
- protected validate(): void;
10
- protected main(value: number): number;
11
- }
12
- //# sourceMappingURL=abs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"abs.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/abs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,SAAa;IACpB,QAAQ,WAA8C;IACtD,QAAQ;;;QAAqD;IAE7D,SAAS,CAAC,QAAQ;IAUlB,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM;CAG7B"}
@@ -1,21 +0,0 @@
1
- import { FormulaError } from "../evaluator";
2
- import { BaseFunction } from "./__base";
3
- import { ensureNumber } from "./__utils";
4
- export class AbsFunction extends BaseFunction {
5
- constructor() {
6
- super(...arguments);
7
- this.example = "ABS(-2)";
8
- this.helpText = ["Returns the absolute value of a number"];
9
- this.helpArgs = [{ name: "value", description: "target number" }];
10
- }
11
- validate() {
12
- if (this.bareArgs.length !== 1) {
13
- throw new FormulaError("#N/A", "Number of arguments for ABS is incorrect.");
14
- }
15
- this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
16
- }
17
- main(value) {
18
- return Math.abs(value);
19
- }
20
- }
21
- //# sourceMappingURL=abs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"abs.js","sourceRoot":"","sources":["../../../src/formula/functions/abs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,WAAY,SAAQ,YAAY;IAA7C;;QACE,YAAO,GAAG,SAAS,CAAC;QACpB,aAAQ,GAAG,CAAC,wCAAwC,CAAC,CAAC;QACtD,aAAQ,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC,CAAC;IAe/D,CAAC;IAbW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,2CAA2C,CAC5C,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;IAES,IAAI,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;CACF"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=abs.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"abs.spec.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/abs.spec.ts"],"names":[],"mappings":""}
@@ -1,29 +0,0 @@
1
- import { AbsFunction } from "./abs";
2
- import { Table } from "../../lib/table";
3
- import { FormulaError, Ref, Value } from "../evaluator";
4
- describe('abs', () => {
5
- const table = new Table({
6
- numRows: 2, numCols: 2, cells: { B2: { value: -222 } }
7
- });
8
- describe('normal', () => {
9
- it('negative to positive', () => {
10
- const f = new AbsFunction({ table, args: [new Value(-111)] });
11
- expect(f.call()).toBe(111);
12
- });
13
- it('refers to a cell', () => {
14
- const f = new AbsFunction({ table, args: [new Ref('B2')] });
15
- expect(f.call()).toBe(222);
16
- });
17
- it('positive to positive', () => {
18
- const f = new AbsFunction({ table, args: [new Value(333)] });
19
- expect(f.call()).toBe(333);
20
- });
21
- });
22
- describe('validation error', () => {
23
- it('missing argument', () => {
24
- const f = new AbsFunction({ table, args: [] });
25
- expect(f.call.bind(f)).toThrow(FormulaError);
26
- });
27
- });
28
- });
29
- //# sourceMappingURL=abs.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"abs.spec.js","sourceRoot":"","sources":["../../../src/formula/functions/abs.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,OAAO,CAAC;AAClC,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAC,YAAY,EAAE,GAAG,EAAE,KAAK,EAAC,MAAM,cAAc,CAAC;AAEtD,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;IACnB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC;QACtB,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,EAAC,EAAE,EAAE,EAAC,KAAK,EAAE,CAAC,GAAG,EAAC,EAAC;KACnD,CAAC,CAAC;IACH,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;QACtB,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;YAC9B,MAAM,CAAC,GAAG,IAAI,WAAW,CAAC,EAAC,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC;YAC5D,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,GAAG,IAAI,WAAW,CAAC,EAAC,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,EAAC,CAAC,CAAC;YAC1D,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;YAC9B,MAAM,CAAC,GAAG,IAAI,WAAW,CAAC,EAAC,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC;YAC3D,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAA;IACF,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;YAC1B,MAAM,CAAC,GAAG,IAAI,WAAW,CAAC,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAC,CAAC,CAAC;YAC7C,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,12 +0,0 @@
1
- import { BaseFunction } from "./__base";
2
- export declare class AcosFunction extends BaseFunction {
3
- example: string;
4
- helpText: string[];
5
- helpArgs: {
6
- name: string;
7
- description: string;
8
- }[];
9
- protected validate(): void;
10
- protected main(value: number): number;
11
- }
12
- //# sourceMappingURL=acos.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"acos.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/acos.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAO,SAAa;IACpB,QAAQ,WAAwD;IAChE,QAAQ;;;QAKN;IAEF,SAAS,CAAC,QAAQ;IAalB,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM;CAG7B"}
@@ -1,29 +0,0 @@
1
- import { FormulaError } from "../evaluator";
2
- import { BaseFunction } from "./__base";
3
- import { ensureNumber } from "./__utils";
4
- export class AcosFunction extends BaseFunction {
5
- constructor() {
6
- super(...arguments);
7
- this.example = "ACOS(0)";
8
- this.helpText = ["Returns the inverse cos of the value in radians."];
9
- this.helpArgs = [
10
- {
11
- name: "value",
12
- description: "A value for the inverse cos between -1 and 1.",
13
- },
14
- ];
15
- }
16
- validate() {
17
- if (this.bareArgs.length !== 1) {
18
- throw new FormulaError("#N/A", "Number of arguments for ACOS is incorrect.");
19
- }
20
- this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
21
- if (-1 > this.bareArgs[0] || this.bareArgs[0] > 1) {
22
- throw new FormulaError("#NUM!", "value must be between -1 and 1");
23
- }
24
- }
25
- main(value) {
26
- return Math.acos(value);
27
- }
28
- }
29
- //# sourceMappingURL=acos.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"acos.js","sourceRoot":"","sources":["../../../src/formula/functions/acos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,YAAa,SAAQ,YAAY;IAA9C;;QACE,YAAO,GAAG,SAAS,CAAC;QACpB,aAAQ,GAAG,CAAC,kDAAkD,CAAC,CAAC;QAChE,aAAQ,GAAG;YACT;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,+CAA+C;aAC7D;SACF,CAAC;IAkBJ,CAAC;IAhBW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,4CAA4C,CAC7C,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9D,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;YACjD,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE,gCAAgC,CAAC,CAAC;SACnE;IACH,CAAC;IAES,IAAI,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;CACF"}
@@ -1,13 +0,0 @@
1
- import { BaseFunction } from "./__base";
2
- import { TimeDelta } from "../../lib/time";
3
- export declare class AddFunction extends BaseFunction {
4
- example: string;
5
- helpText: string[];
6
- helpArgs: {
7
- name: string;
8
- description: string;
9
- }[];
10
- protected validate(): void;
11
- protected main(v1: number | Date | TimeDelta, v2: number | Date | TimeDelta): number | Date;
12
- }
13
- //# sourceMappingURL=add.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/add.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAGzC,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,SAAe;IACtB,QAAQ,WAGN;IACF,QAAQ;;;QAGN;IAEF,SAAS,CAAC,QAAQ;IAelB,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;CAqB5E"}
@@ -1,50 +0,0 @@
1
- import { FormulaError } from "../evaluator";
2
- import { BaseFunction } from "./__base";
3
- import { ensureNumber, stripTable } from "./__utils";
4
- import { Table } from "../../lib/table";
5
- import { TimeDelta } from "../../lib/time";
6
- import { addSeconds } from "date-fns";
7
- export class AddFunction extends BaseFunction {
8
- constructor() {
9
- super(...arguments);
10
- this.example = "ADD(2, 3)";
11
- this.helpText = [
12
- "Returns the sum of two numbers.",
13
- "This is the same as the '+' operator.",
14
- ];
15
- this.helpArgs = [
16
- { name: "value1", description: "First additive." },
17
- { name: "value2", description: "Second additive." },
18
- ];
19
- }
20
- validate() {
21
- if (this.bareArgs.length !== 2) {
22
- throw new FormulaError("#N/A", "Number of arguments for ADD is incorrect.");
23
- }
24
- this.bareArgs = this.bareArgs.map((arg) => {
25
- if (arg instanceof Table) {
26
- arg = stripTable(arg, 0, 0);
27
- }
28
- return typeof arg === "object" ? arg : ensureNumber(arg);
29
- });
30
- }
31
- main(v1, v2) {
32
- if (typeof v1 === "number" && typeof v2 === "number") {
33
- return v1 + v2;
34
- }
35
- if (v1 instanceof Date && v2 instanceof TimeDelta) {
36
- return v2.add(v1);
37
- }
38
- if (v1 instanceof TimeDelta && v2 instanceof Date) {
39
- return v1.add(v2);
40
- }
41
- if (v1 instanceof Date && typeof v2 === "number") {
42
- return addSeconds(v1, v2);
43
- }
44
- if (typeof v1 === "number" && v2 instanceof Date) {
45
- return addSeconds(v2, v1);
46
- }
47
- throw new FormulaError("#VALUE!", "Mismatched types for augend and addend.");
48
- }
49
- }
50
- //# sourceMappingURL=add.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/formula/functions/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,WAAW,CAAC;AACnD,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEpC,MAAM,OAAO,WAAY,SAAQ,YAAY;IAA7C;;QACE,YAAO,GAAG,WAAW,CAAC;QACtB,aAAQ,GAAG;YACT,iCAAiC;YACjC,uCAAuC;SACxC,CAAC;QACF,aAAQ,GAAG;YACT,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,EAAE;YAClD,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE;SACpD,CAAC;IAsCJ,CAAC;IApCW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,2CAA2C,CAC5C,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACxC,IAAI,GAAG,YAAY,KAAK,EAAE;gBACxB,GAAG,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;aAC7B;YACD,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC;IAES,IAAI,CAAC,EAA6B,EAAE,EAA6B;QACzE,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;YACpD,OAAO,EAAE,GAAG,EAAE,CAAC;SAChB;QACD,IAAI,EAAE,YAAY,IAAI,IAAI,EAAE,YAAY,SAAS,EAAE;YACjD,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SACnB;QACD,IAAI,EAAE,YAAY,SAAS,IAAI,EAAE,YAAY,IAAI,EAAE;YACjD,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SACnB;QACD,IAAI,EAAE,YAAY,IAAI,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;YAChD,OAAO,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;SAC3B;QACD,IAAI,OAAO,EAAE,KAAM,QAAQ,IAAI,EAAE,YAAY,IAAI,EAAE;YACjD,OAAO,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;SAC3B;QACD,MAAM,IAAI,YAAY,CACpB,SAAS,EACT,yCAAyC,CAC1C,CAAC;IACJ,CAAC;CACF"}
@@ -1,19 +0,0 @@
1
- import { BaseFunction } from "./__base";
2
- export declare class AndFunction extends BaseFunction {
3
- example: string;
4
- helpText: string[];
5
- helpArgs: ({
6
- name: string;
7
- description: string;
8
- optional?: undefined;
9
- iterable?: undefined;
10
- } | {
11
- name: string;
12
- description: string;
13
- optional: boolean;
14
- iterable: boolean;
15
- })[];
16
- protected validate(): void;
17
- protected main(...values: boolean[]): boolean;
18
- }
19
- //# sourceMappingURL=and.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"and.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/and.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,SAAqB;IAC5B,QAAQ,WAGN;IACF,QAAQ;;;;;;;;;;SAQN;IAEF,SAAS,CAAC,QAAQ;IAIlB,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE;CAGpC"}
@@ -1,28 +0,0 @@
1
- import { BaseFunction } from "./__base";
2
- import { ensureBoolean } from "./__utils";
3
- export class AndFunction extends BaseFunction {
4
- constructor() {
5
- super(...arguments);
6
- this.example = "AND(A1=1, A2=2)";
7
- this.helpText = [
8
- "Returns TRUE if all arguments are logically TRUE.",
9
- "Returns FALSE if any argument is logically FALSE.",
10
- ];
11
- this.helpArgs = [
12
- { name: "expression1", description: "First logical expression." },
13
- {
14
- name: "expression2",
15
- description: "Additional expressions",
16
- optional: true,
17
- iterable: true,
18
- },
19
- ];
20
- }
21
- validate() {
22
- this.bareArgs = this.bareArgs.map((arg) => ensureBoolean(arg));
23
- }
24
- main(...values) {
25
- return values.reduce((a, b) => a && b);
26
- }
27
- }
28
- //# sourceMappingURL=and.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"and.js","sourceRoot":"","sources":["../../../src/formula/functions/and.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,OAAO,WAAY,SAAQ,YAAY;IAA7C;;QACE,YAAO,GAAG,iBAAiB,CAAC;QAC5B,aAAQ,GAAG;YACT,mDAAmD;YACnD,mDAAmD;SACpD,CAAC;QACF,aAAQ,GAAG;YACT,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,2BAA2B,EAAE;YACjE;gBACE,IAAI,EAAE,aAAa;gBACnB,WAAW,EAAE,wBAAwB;gBACrC,QAAQ,EAAE,IAAI;gBACd,QAAQ,EAAE,IAAI;aACf;SACF,CAAC;IASJ,CAAC;IAPW,QAAQ;QAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IACjE,CAAC;IAES,IAAI,CAAC,GAAG,MAAiB;QACjC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;CACF"}
@@ -1,12 +0,0 @@
1
- import { BaseFunction } from "./__base";
2
- export declare class AsinFunction extends BaseFunction {
3
- example: string;
4
- helpText: string[];
5
- helpArgs: {
6
- name: string;
7
- description: string;
8
- }[];
9
- protected validate(): void;
10
- protected main(value: number): number;
11
- }
12
- //# sourceMappingURL=asin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asin.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/asin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAO,SAAa;IACpB,QAAQ,WAAwD;IAChE,QAAQ;;;QAKN;IAEF,SAAS,CAAC,QAAQ;IAalB,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM;CAG7B"}
@@ -1,29 +0,0 @@
1
- import { FormulaError } from "../evaluator";
2
- import { BaseFunction } from "./__base";
3
- import { ensureNumber } from "./__utils";
4
- export class AsinFunction extends BaseFunction {
5
- constructor() {
6
- super(...arguments);
7
- this.example = "ASIN(0)";
8
- this.helpText = ["Returns the inverse sin of the value in radians."];
9
- this.helpArgs = [
10
- {
11
- name: "value",
12
- description: "A value for the inverse sin between -1 and 1.",
13
- },
14
- ];
15
- }
16
- validate() {
17
- if (this.bareArgs.length !== 1) {
18
- throw new FormulaError("#N/A", "Number of arguments for ASIN is incorrect.");
19
- }
20
- this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
21
- if (-1 > this.bareArgs[0] || this.bareArgs[0] > 1) {
22
- throw new FormulaError("#NUM!", "value must be between -1 and 1");
23
- }
24
- }
25
- main(value) {
26
- return Math.asin(value);
27
- }
28
- }
29
- //# sourceMappingURL=asin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asin.js","sourceRoot":"","sources":["../../../src/formula/functions/asin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,YAAa,SAAQ,YAAY;IAA9C;;QACE,YAAO,GAAG,SAAS,CAAC;QACpB,aAAQ,GAAG,CAAC,kDAAkD,CAAC,CAAC;QAChE,aAAQ,GAAG;YACT;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,+CAA+C;aAC7D;SACF,CAAC;IAkBJ,CAAC;IAhBW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,4CAA4C,CAC7C,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9D,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;YACjD,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE,gCAAgC,CAAC,CAAC;SACnE;IACH,CAAC;IAES,IAAI,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;CACF"}
@@ -1,12 +0,0 @@
1
- import { BaseFunction } from "./__base";
2
- export declare class AtanFunction extends BaseFunction {
3
- example: string;
4
- helpText: string[];
5
- helpArgs: {
6
- name: string;
7
- description: string;
8
- }[];
9
- protected validate(): void;
10
- protected main(value: number): number;
11
- }
12
- //# sourceMappingURL=atan.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"atan.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/atan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAO,SAAa;IACpB,QAAQ,WAAwD;IAChE,QAAQ;;;QAKN;IAEF,SAAS,CAAC,QAAQ;IAUlB,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM;CAG7B"}
@@ -1,26 +0,0 @@
1
- import { FormulaError } from "../evaluator";
2
- import { BaseFunction } from "./__base";
3
- import { ensureNumber } from "./__utils";
4
- export class AtanFunction extends BaseFunction {
5
- constructor() {
6
- super(...arguments);
7
- this.example = "ATAN(1)";
8
- this.helpText = ["Returns the inverse tan of the value in radians."];
9
- this.helpArgs = [
10
- {
11
- name: "value",
12
- description: "A value for the inverse tan.",
13
- },
14
- ];
15
- }
16
- validate() {
17
- if (this.bareArgs.length !== 1) {
18
- throw new FormulaError("#N/A", "Number of arguments for ATAN is incorrect.");
19
- }
20
- this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
21
- }
22
- main(value) {
23
- return Math.atan(value);
24
- }
25
- }
26
- //# sourceMappingURL=atan.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"atan.js","sourceRoot":"","sources":["../../../src/formula/functions/atan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,YAAa,SAAQ,YAAY;IAA9C;;QACE,YAAO,GAAG,SAAS,CAAC;QACpB,aAAQ,GAAG,CAAC,kDAAkD,CAAC,CAAC;QAChE,aAAQ,GAAG;YACT;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,8BAA8B;aAC5C;SACF,CAAC;IAeJ,CAAC;IAbW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,4CAA4C,CAC7C,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;IAES,IAAI,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;CACF"}
@@ -1,12 +0,0 @@
1
- import { BaseFunction } from "./__base";
2
- export declare class Atan2Function extends BaseFunction {
3
- example: string;
4
- helpText: string[];
5
- helpArgs: {
6
- name: string;
7
- description: string;
8
- }[];
9
- protected validate(): void;
10
- protected main(x: number, y: number): number;
11
- }
12
- //# sourceMappingURL=atan2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"atan2.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/atan2.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,aAAc,SAAQ,YAAY;IAC7C,OAAO,SAAgB;IACvB,QAAQ,WAEN;IACF,QAAQ;;;QASN;IAEF,SAAS,CAAC,QAAQ;IAUlB,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;CAGpC"}
@@ -1,32 +0,0 @@
1
- import { FormulaError } from "../evaluator";
2
- import { BaseFunction } from "./__base";
3
- import { ensureNumber } from "./__utils";
4
- export class Atan2Function extends BaseFunction {
5
- constructor() {
6
- super(...arguments);
7
- this.example = "ATAN2(4,3)";
8
- this.helpText = [
9
- "Returns the angle in radians between the x-axis and a line passing from the origin through a given coordinate point (x, y).",
10
- ];
11
- this.helpArgs = [
12
- {
13
- name: "x",
14
- description: "x of the point.",
15
- },
16
- {
17
- name: "y",
18
- description: "y of the point.",
19
- },
20
- ];
21
- }
22
- validate() {
23
- if (this.bareArgs.length !== 2) {
24
- throw new FormulaError("#N/A", "Number of arguments for ATAN2 is incorrect.");
25
- }
26
- this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
27
- }
28
- main(x, y) {
29
- return Math.atan2(x, y);
30
- }
31
- }
32
- //# sourceMappingURL=atan2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"atan2.js","sourceRoot":"","sources":["../../../src/formula/functions/atan2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,aAAc,SAAQ,YAAY;IAA/C;;QACE,YAAO,GAAG,YAAY,CAAC;QACvB,aAAQ,GAAG;YACT,6HAA6H;SAC9H,CAAC;QACF,aAAQ,GAAG;YACT;gBACE,IAAI,EAAE,GAAG;gBACT,WAAW,EAAE,iBAAiB;aAC/B;YACD;gBACE,IAAI,EAAE,GAAG;gBACT,WAAW,EAAE,iBAAiB;aAC/B;SACF,CAAC;IAeJ,CAAC;IAbW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,6CAA6C,CAC9C,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;IAES,IAAI,CAAC,CAAS,EAAE,CAAS;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;CACF"}
@@ -1,19 +0,0 @@
1
- import { BaseFunction } from "./__base";
2
- export declare class AverageFunction extends BaseFunction {
3
- example: string;
4
- helpText: string[];
5
- helpArgs: ({
6
- name: string;
7
- description: string;
8
- optional?: undefined;
9
- iterable?: undefined;
10
- } | {
11
- name: string;
12
- description: string;
13
- optional: boolean;
14
- iterable: boolean;
15
- })[];
16
- protected validate(): void;
17
- protected main(...values: number[]): number;
18
- }
19
- //# sourceMappingURL=average.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"average.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/average.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,OAAO,SAA2B;IAClC,QAAQ,WAA4D;IACpE,QAAQ;;;;;;;;;;SAQN;IAEF,SAAS,CAAC,QAAQ;IAsBlB,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE;CAGnC"}
@@ -1,41 +0,0 @@
1
- import { FormulaError } from "../evaluator";
2
- import { solveTable } from "../solver";
3
- import { Table } from "../../lib/table";
4
- import { BaseFunction } from "./__base";
5
- import { ensureNumber } from "./__utils";
6
- export class AverageFunction extends BaseFunction {
7
- constructor() {
8
- super(...arguments);
9
- this.example = "AVERAGE(A2:A100, 101)";
10
- this.helpText = ["Returns the average of a series of numbers or cells."];
11
- this.helpArgs = [
12
- { name: "value1", description: "First number or range." },
13
- {
14
- name: "value2",
15
- description: "Additional numbers or ranges",
16
- optional: true,
17
- iterable: true,
18
- },
19
- ];
20
- }
21
- validate() {
22
- const spreaded = [];
23
- this.bareArgs.map((arg) => {
24
- if (arg instanceof Table) {
25
- spreaded.push(...solveTable({ table: arg })
26
- .reduce((a, b) => a.concat(b))
27
- .filter((v) => typeof v === "number"));
28
- return;
29
- }
30
- spreaded.push(ensureNumber(arg));
31
- });
32
- if (spreaded.length === 0) {
33
- throw new FormulaError("#N/A", "Number of arguments must be greater than 0.");
34
- }
35
- this.bareArgs = spreaded;
36
- }
37
- main(...values) {
38
- return values.reduce((a, b) => a + b) / values.length;
39
- }
40
- }
41
- //# sourceMappingURL=average.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"average.js","sourceRoot":"","sources":["../../../src/formula/functions/average.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAAjD;;QACE,YAAO,GAAG,uBAAuB,CAAC;QAClC,aAAQ,GAAG,CAAC,sDAAsD,CAAC,CAAC;QACpE,aAAQ,GAAG;YACT,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;YACzD;gBACE,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,8BAA8B;gBAC3C,QAAQ,EAAE,IAAI;gBACd,QAAQ,EAAE,IAAI;aACf;SACF,CAAC;IA2BJ,CAAC;IAzBW,QAAQ;QAChB,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACxB,IAAI,GAAG,YAAY,KAAK,EAAE;gBACxB,QAAQ,CAAC,IAAI,CACX,GAAG,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;qBAC1B,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;qBAC7B,MAAM,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAC7C,CAAC;gBACF,OAAO;aACR;YACD,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,6CAA6C,CAC9C,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAES,IAAI,CAAC,GAAG,MAAgB;QAChC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IACxD,CAAC;CACF"}
@@ -1,14 +0,0 @@
1
- import { Table } from "../../lib/table";
2
- import { BaseFunction } from "./__base";
3
- export declare class ColFunction extends BaseFunction {
4
- example: string;
5
- helpText: string[];
6
- helpArgs: {
7
- name: string;
8
- description: string;
9
- option: boolean;
10
- }[];
11
- protected validate(): void;
12
- protected main(trimmed: Table): number;
13
- }
14
- //# sourceMappingURL=col.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"col.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/col.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,SAAa;IACpB,QAAQ,WAAmD;IAC3D,QAAQ;;;;QAMN;IAEF,SAAS,CAAC,QAAQ;IAYlB,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK;CAG9B"}