@gridsheet/react-core 1.4.0 → 2.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/Cell.d.ts +3 -3
- package/dist/components/Cell.d.ts.map +1 -1
- package/dist/components/ContextMenu.d.ts +19 -2
- package/dist/components/ContextMenu.d.ts.map +1 -1
- package/dist/components/Editor.d.ts +4 -4
- package/dist/components/Editor.d.ts.map +1 -1
- package/dist/components/Emitter.d.ts +2 -2
- package/dist/components/Emitter.d.ts.map +1 -1
- package/dist/components/Fixed.d.ts +3 -3
- package/dist/components/Fixed.d.ts.map +1 -1
- package/dist/components/FormulaBar.d.ts +1 -2
- package/dist/components/FormulaBar.d.ts.map +1 -1
- package/dist/components/GridSheet.d.ts +1 -2
- package/dist/components/GridSheet.d.ts.map +1 -1
- package/dist/components/HeaderCellLeft.d.ts +2 -2
- package/dist/components/HeaderCellLeft.d.ts.map +1 -1
- package/dist/components/HeaderCellTop.d.ts +2 -2
- package/dist/components/HeaderCellTop.d.ts.map +1 -1
- package/dist/components/PluginBase.d.ts +4 -4
- package/dist/components/PluginBase.d.ts.map +1 -1
- package/dist/components/Resizer.d.ts +1 -2
- package/dist/components/Resizer.d.ts.map +1 -1
- package/dist/components/ScrollHandle.d.ts +9 -0
- package/dist/components/ScrollHandle.d.ts.map +1 -0
- package/dist/components/SearchBar.d.ts +1 -2
- package/dist/components/SearchBar.d.ts.map +1 -1
- package/dist/components/StoreObserver.d.ts +11 -0
- package/dist/components/StoreObserver.d.ts.map +1 -0
- package/dist/components/Tabular.d.ts +3 -3
- package/dist/components/Tabular.d.ts.map +1 -1
- package/dist/components/hooks.d.ts +2 -0
- package/dist/components/hooks.d.ts.map +1 -1
- package/dist/components/svg/AddIcon.d.ts +1 -2
- package/dist/components/svg/AddIcon.d.ts.map +1 -1
- package/dist/components/svg/Base.d.ts +4 -4
- package/dist/components/svg/Base.d.ts.map +1 -1
- package/dist/components/svg/CloseIcon.d.ts +1 -2
- package/dist/components/svg/CloseIcon.d.ts.map +1 -1
- package/dist/components/svg/SearchIcon.d.ts +1 -2
- package/dist/components/svg/SearchIcon.d.ts.map +1 -1
- package/dist/constants.d.ts +3 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/formula/evaluator.d.ts +42 -18
- package/dist/formula/evaluator.d.ts.map +1 -1
- package/dist/formula/functions/__base.d.ts.map +1 -1
- package/dist/formula/functions/__utils.d.ts +5 -2
- package/dist/formula/functions/__utils.d.ts.map +1 -1
- package/dist/formula/functions/abs.d.ts.map +1 -1
- package/dist/formula/functions/acos.d.ts.map +1 -1
- package/dist/formula/functions/add.d.ts +1 -1
- package/dist/formula/functions/add.d.ts.map +1 -1
- package/dist/formula/functions/and.d.ts.map +1 -1
- package/dist/formula/functions/asin.d.ts.map +1 -1
- package/dist/formula/functions/atan.d.ts.map +1 -1
- package/dist/formula/functions/atan2.d.ts.map +1 -1
- package/dist/formula/functions/average.d.ts.map +1 -1
- package/dist/formula/functions/col.d.ts.map +1 -1
- package/dist/formula/functions/concat.d.ts.map +1 -1
- package/dist/formula/functions/concatenate.d.ts.map +1 -1
- package/dist/formula/functions/cos.d.ts.map +1 -1
- package/dist/formula/functions/count.d.ts.map +1 -1
- package/dist/formula/functions/counta.d.ts.map +1 -1
- package/dist/formula/functions/countif.d.ts.map +1 -1
- package/dist/formula/functions/divide.d.ts.map +1 -1
- package/dist/formula/functions/eq.d.ts.map +1 -1
- package/dist/formula/functions/exp.d.ts.map +1 -1
- package/dist/formula/functions/gt.d.ts.map +1 -1
- package/dist/formula/functions/gte.d.ts.map +1 -1
- package/dist/formula/functions/hlookup.d.ts.map +1 -1
- package/dist/formula/functions/if.d.ts.map +1 -1
- package/dist/formula/functions/iferror.d.ts.map +1 -1
- package/dist/formula/functions/index.d.ts +18 -0
- package/dist/formula/functions/index.d.ts.map +1 -0
- package/dist/formula/functions/len.d.ts.map +1 -1
- package/dist/formula/functions/lenb.d.ts.map +1 -1
- package/dist/formula/functions/ln.d.ts.map +1 -1
- package/dist/formula/functions/log.d.ts.map +1 -1
- package/dist/formula/functions/log10.d.ts.map +1 -1
- package/dist/formula/functions/lt.d.ts.map +1 -1
- package/dist/formula/functions/lte.d.ts.map +1 -1
- package/dist/formula/functions/match.d.ts +18 -0
- package/dist/formula/functions/match.d.ts.map +1 -0
- package/dist/formula/functions/match.test.d.ts +2 -0
- package/dist/formula/functions/match.test.d.ts.map +1 -0
- package/dist/formula/functions/max.d.ts.map +1 -1
- package/dist/formula/functions/min.d.ts.map +1 -1
- package/dist/formula/functions/minus.d.ts.map +1 -1
- package/dist/formula/functions/mod.d.ts.map +1 -1
- package/dist/formula/functions/multiply.d.ts.map +1 -1
- package/dist/formula/functions/ne.d.ts.map +1 -1
- package/dist/formula/functions/not.d.ts.map +1 -1
- package/dist/formula/functions/now.d.ts.map +1 -1
- package/dist/formula/functions/or.d.ts.map +1 -1
- package/dist/formula/functions/pi.d.ts.map +1 -1
- package/dist/formula/functions/power.d.ts.map +1 -1
- package/dist/formula/functions/product.d.ts.map +1 -1
- package/dist/formula/functions/radians.d.ts.map +1 -1
- package/dist/formula/functions/rand.d.ts.map +1 -1
- package/dist/formula/functions/round.d.ts.map +1 -1
- package/dist/formula/functions/rounddown.d.ts.map +1 -1
- package/dist/formula/functions/roundup.d.ts.map +1 -1
- package/dist/formula/functions/row.d.ts.map +1 -1
- package/dist/formula/functions/sin.d.ts.map +1 -1
- package/dist/formula/functions/sqrt.d.ts.map +1 -1
- package/dist/formula/functions/sum.d.ts.map +1 -1
- package/dist/formula/functions/sumif.d.ts.map +1 -1
- package/dist/formula/functions/tan.d.ts.map +1 -1
- package/dist/formula/functions/uminus.d.ts.map +1 -1
- package/dist/formula/functions/vlookup.d.ts.map +1 -1
- package/dist/formula/mapping.d.ts.map +1 -1
- package/dist/formula/solver.d.ts +10 -7
- package/dist/formula/solver.d.ts.map +1 -1
- package/dist/index.d.ts +15 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10330 -20
- package/dist/index.js.map +1 -1
- package/dist/lib/autofill.d.ts +2 -2
- package/dist/lib/autofill.d.ts.map +1 -1
- package/dist/lib/clipboard.d.ts.map +1 -1
- package/dist/lib/converters.d.ts +3 -4
- package/dist/lib/converters.d.ts.map +1 -1
- package/dist/lib/events.d.ts +6 -0
- package/dist/lib/events.d.ts.map +1 -0
- package/dist/lib/hub.d.ts +72 -0
- package/dist/lib/hub.d.ts.map +1 -0
- package/dist/lib/input.d.ts +12 -2
- package/dist/lib/input.d.ts.map +1 -1
- package/dist/lib/operation.d.ts +27 -0
- package/dist/lib/operation.d.ts.map +1 -0
- package/dist/lib/palette.d.ts +1 -1
- package/dist/lib/palette.d.ts.map +1 -1
- package/dist/lib/paste.d.ts +4 -0
- package/dist/lib/paste.d.ts.map +1 -0
- package/dist/lib/reference.d.ts +13 -0
- package/dist/lib/reference.d.ts.map +1 -0
- package/dist/lib/sheet.d.ts +3 -0
- package/dist/lib/sheet.d.ts.map +1 -0
- package/dist/lib/structs.d.ts +12 -3
- package/dist/lib/structs.d.ts.map +1 -1
- package/dist/lib/table.d.ts +152 -91
- package/dist/lib/table.d.ts.map +1 -1
- package/dist/lib/time.d.ts +1 -0
- package/dist/lib/time.d.ts.map +1 -1
- package/dist/lib/virtualization.d.ts +3 -2
- package/dist/lib/virtualization.d.ts.map +1 -1
- package/dist/parsers/core.d.ts +2 -0
- package/dist/parsers/core.d.ts.map +1 -1
- package/dist/policy/core.d.ts +47 -0
- package/dist/policy/core.d.ts.map +1 -0
- package/dist/renderers/checkbox.d.ts +2 -2
- package/dist/renderers/checkbox.d.ts.map +1 -1
- package/dist/renderers/core.d.ts +39 -25
- package/dist/renderers/core.d.ts.map +1 -1
- package/dist/renderers/thousand_separator.d.ts +2 -3
- package/dist/renderers/thousand_separator.d.ts.map +1 -1
- package/dist/store/actions.d.ts +141 -49
- package/dist/store/actions.d.ts.map +1 -1
- package/dist/store/dispatchers.d.ts +13 -0
- package/dist/store/dispatchers.d.ts.map +1 -0
- package/dist/store/helpers.d.ts +1 -0
- package/dist/store/helpers.d.ts.map +1 -1
- package/dist/store/index.d.ts +1 -2
- package/dist/store/index.d.ts.map +1 -1
- package/dist/styles/embedder.d.ts.map +1 -1
- package/dist/styles/minified.d.ts +2 -2
- package/dist/styles/minified.d.ts.map +1 -1
- package/dist/styles/utils.d.ts +52 -0
- package/dist/styles/utils.d.ts.map +1 -0
- package/dist/types.d.ts +112 -55
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +7 -10
- package/dist/_virtual/_commonjsHelpers.js +0 -7
- package/dist/_virtual/_commonjsHelpers.js.map +0 -1
- package/dist/_virtual/dayjs.min.js +0 -8
- package/dist/_virtual/dayjs.min.js.map +0 -1
- package/dist/_virtual/dayjs.min2.js +0 -5
- package/dist/_virtual/dayjs.min2.js.map +0 -1
- package/dist/_virtual/timezone.js +0 -8
- package/dist/_virtual/timezone.js.map +0 -1
- package/dist/_virtual/timezone2.js +0 -5
- package/dist/_virtual/timezone2.js.map +0 -1
- package/dist/_virtual/utc.js +0 -8
- package/dist/_virtual/utc.js.map +0 -1
- package/dist/_virtual/utc2.js +0 -5
- package/dist/_virtual/utc2.js.map +0 -1
- package/dist/components/Cell.js +0 -234
- package/dist/components/Cell.js.map +0 -1
- package/dist/components/ContextMenu.js +0 -297
- package/dist/components/ContextMenu.js.map +0 -1
- package/dist/components/Editor.js +0 -464
- package/dist/components/Editor.js.map +0 -1
- package/dist/components/Emitter.js +0 -26
- package/dist/components/Emitter.js.map +0 -1
- package/dist/components/Fixed.js +0 -17
- package/dist/components/Fixed.js.map +0 -1
- package/dist/components/FormulaBar.js +0 -150
- package/dist/components/FormulaBar.js.map +0 -1
- package/dist/components/GridSheet.js +0 -247
- package/dist/components/GridSheet.js.map +0 -1
- package/dist/components/HeaderCellLeft.js +0 -131
- package/dist/components/HeaderCellLeft.js.map +0 -1
- package/dist/components/HeaderCellTop.js +0 -132
- package/dist/components/HeaderCellTop.js.map +0 -1
- package/dist/components/PluginBase.js +0 -35
- package/dist/components/PluginBase.js.map +0 -1
- package/dist/components/Resizer.js +0 -98
- package/dist/components/Resizer.js.map +0 -1
- package/dist/components/SearchBar.js +0 -108
- package/dist/components/SearchBar.js.map +0 -1
- package/dist/components/SheetProvider.d.ts +0 -30
- package/dist/components/SheetProvider.d.ts.map +0 -1
- package/dist/components/SheetProvider.js +0 -59
- package/dist/components/SheetProvider.js.map +0 -1
- package/dist/components/StoreInitializer.d.ts +0 -4
- package/dist/components/StoreInitializer.d.ts.map +0 -1
- package/dist/components/StoreInitializer.js +0 -84
- package/dist/components/StoreInitializer.js.map +0 -1
- package/dist/components/Tabular.js +0 -317
- package/dist/components/Tabular.js.map +0 -1
- package/dist/components/Toggle.d.ts +0 -12
- package/dist/components/Toggle.d.ts.map +0 -1
- package/dist/components/hooks.js +0 -15
- package/dist/components/hooks.js.map +0 -1
- package/dist/components/svg/Base.js +0 -24
- package/dist/components/svg/Base.js.map +0 -1
- package/dist/components/svg/CloseIcon.js +0 -13
- package/dist/components/svg/CloseIcon.js.map +0 -1
- package/dist/components/svg/SearchIcon.js +0 -13
- package/dist/components/svg/SearchIcon.js.map +0 -1
- package/dist/constants.js +0 -43
- package/dist/constants.js.map +0 -1
- package/dist/formula/evaluator.js +0 -679
- package/dist/formula/evaluator.js.map +0 -1
- package/dist/formula/functions/__base.js +0 -20
- package/dist/formula/functions/__base.js.map +0 -1
- package/dist/formula/functions/__utils.js +0 -145
- package/dist/formula/functions/__utils.js.map +0 -1
- package/dist/formula/functions/abs.js +0 -24
- package/dist/formula/functions/abs.js.map +0 -1
- package/dist/formula/functions/abs.spec.d.ts +0 -2
- package/dist/formula/functions/abs.spec.d.ts.map +0 -1
- package/dist/formula/functions/acos.js +0 -32
- package/dist/formula/functions/acos.js.map +0 -1
- package/dist/formula/functions/add.js +0 -57
- package/dist/formula/functions/add.js.map +0 -1
- package/dist/formula/functions/and.js +0 -28
- package/dist/formula/functions/and.js.map +0 -1
- package/dist/formula/functions/asin.js +0 -32
- package/dist/formula/functions/asin.js.map +0 -1
- package/dist/formula/functions/atan.js +0 -29
- package/dist/formula/functions/atan.js.map +0 -1
- package/dist/formula/functions/atan2.js +0 -35
- package/dist/formula/functions/atan2.js.map +0 -1
- package/dist/formula/functions/average.js +0 -44
- package/dist/formula/functions/average.js.map +0 -1
- package/dist/formula/functions/col.js +0 -34
- package/dist/formula/functions/col.js.map +0 -1
- package/dist/formula/functions/col.spec.d.ts +0 -2
- package/dist/formula/functions/col.spec.d.ts.map +0 -1
- package/dist/formula/functions/concat.js +0 -27
- package/dist/formula/functions/concat.js.map +0 -1
- package/dist/formula/functions/concatenate.js +0 -28
- package/dist/formula/functions/concatenate.js.map +0 -1
- package/dist/formula/functions/cos.js +0 -29
- package/dist/formula/functions/cos.js.map +0 -1
- package/dist/formula/functions/count.js +0 -38
- package/dist/formula/functions/count.js.map +0 -1
- package/dist/formula/functions/counta.js +0 -38
- package/dist/formula/functions/counta.js.map +0 -1
- package/dist/formula/functions/countif.js +0 -32
- package/dist/formula/functions/countif.js.map +0 -1
- package/dist/formula/functions/countif.spec.d.ts +0 -2
- package/dist/formula/functions/countif.spec.d.ts.map +0 -1
- package/dist/formula/functions/divide.js +0 -33
- package/dist/formula/functions/divide.js.map +0 -1
- package/dist/formula/functions/eq.js +0 -29
- package/dist/formula/functions/eq.js.map +0 -1
- package/dist/formula/functions/eq.spec.d.ts +0 -2
- package/dist/formula/functions/eq.spec.d.ts.map +0 -1
- package/dist/formula/functions/exp.js +0 -29
- package/dist/formula/functions/exp.js.map +0 -1
- package/dist/formula/functions/gt.js +0 -29
- package/dist/formula/functions/gt.js.map +0 -1
- package/dist/formula/functions/gte.js +0 -29
- package/dist/formula/functions/gte.js.map +0 -1
- package/dist/formula/functions/hlookup.js +0 -75
- package/dist/formula/functions/hlookup.js.map +0 -1
- package/dist/formula/functions/if.js +0 -39
- package/dist/formula/functions/if.js.map +0 -1
- package/dist/formula/functions/iferror.js +0 -45
- package/dist/formula/functions/iferror.js.map +0 -1
- package/dist/formula/functions/iferror.spec.d.ts +0 -2
- package/dist/formula/functions/iferror.spec.d.ts.map +0 -1
- package/dist/formula/functions/len.js +0 -29
- package/dist/formula/functions/len.js.map +0 -1
- package/dist/formula/functions/lenb.js +0 -29
- package/dist/formula/functions/lenb.js.map +0 -1
- package/dist/formula/functions/ln.js +0 -32
- package/dist/formula/functions/ln.js.map +0 -1
- package/dist/formula/functions/log.js +0 -36
- package/dist/formula/functions/log.js.map +0 -1
- package/dist/formula/functions/log10.js +0 -32
- package/dist/formula/functions/log10.js.map +0 -1
- package/dist/formula/functions/lt.js +0 -29
- package/dist/formula/functions/lt.js.map +0 -1
- package/dist/formula/functions/lte.js +0 -29
- package/dist/formula/functions/lte.js.map +0 -1
- package/dist/formula/functions/max.js +0 -47
- package/dist/formula/functions/max.js.map +0 -1
- package/dist/formula/functions/min.js +0 -47
- package/dist/formula/functions/min.js.map +0 -1
- package/dist/formula/functions/minus.js +0 -57
- package/dist/formula/functions/minus.js.map +0 -1
- package/dist/formula/functions/mod.js +0 -33
- package/dist/formula/functions/mod.js.map +0 -1
- package/dist/formula/functions/mod.spec.d.ts +0 -2
- package/dist/formula/functions/mod.spec.d.ts.map +0 -1
- package/dist/formula/functions/multiply.js +0 -27
- package/dist/formula/functions/multiply.js.map +0 -1
- package/dist/formula/functions/ne.js +0 -29
- package/dist/formula/functions/ne.js.map +0 -1
- package/dist/formula/functions/not.js +0 -30
- package/dist/formula/functions/not.js.map +0 -1
- package/dist/formula/functions/now.js +0 -22
- package/dist/formula/functions/now.js.map +0 -1
- package/dist/formula/functions/or.js +0 -28
- package/dist/formula/functions/or.js.map +0 -1
- package/dist/formula/functions/pi.js +0 -22
- package/dist/formula/functions/pi.js.map +0 -1
- package/dist/formula/functions/power.js +0 -27
- package/dist/formula/functions/power.js.map +0 -1
- package/dist/formula/functions/product.js +0 -40
- package/dist/formula/functions/product.js.map +0 -1
- package/dist/formula/functions/radians.js +0 -29
- package/dist/formula/functions/radians.js.map +0 -1
- package/dist/formula/functions/rand.js +0 -22
- package/dist/formula/functions/rand.js.map +0 -1
- package/dist/formula/functions/round.js +0 -35
- package/dist/formula/functions/round.js.map +0 -1
- package/dist/formula/functions/rounddown.js +0 -35
- package/dist/formula/functions/rounddown.js.map +0 -1
- package/dist/formula/functions/roundup.js +0 -35
- package/dist/formula/functions/roundup.js.map +0 -1
- package/dist/formula/functions/row.js +0 -34
- package/dist/formula/functions/row.js.map +0 -1
- package/dist/formula/functions/row.spec.d.ts +0 -2
- package/dist/formula/functions/row.spec.d.ts.map +0 -1
- package/dist/formula/functions/sin.js +0 -29
- package/dist/formula/functions/sin.js.map +0 -1
- package/dist/formula/functions/sqrt.js +0 -32
- package/dist/formula/functions/sqrt.js.map +0 -1
- package/dist/formula/functions/sum.js +0 -47
- package/dist/formula/functions/sum.js.map +0 -1
- package/dist/formula/functions/sum.spec.d.ts +0 -2
- package/dist/formula/functions/sum.spec.d.ts.map +0 -1
- package/dist/formula/functions/sumif.js +0 -65
- package/dist/formula/functions/sumif.js.map +0 -1
- package/dist/formula/functions/tan.js +0 -29
- package/dist/formula/functions/tan.js.map +0 -1
- package/dist/formula/functions/uminus.js +0 -24
- package/dist/formula/functions/uminus.js.map +0 -1
- package/dist/formula/functions/vlookup.js +0 -75
- package/dist/formula/functions/vlookup.js.map +0 -1
- package/dist/formula/mapping.js +0 -119
- package/dist/formula/mapping.js.map +0 -1
- package/dist/formula/solver.js +0 -70
- package/dist/formula/solver.js.map +0 -1
- package/dist/lib/autofill.js +0 -391
- package/dist/lib/autofill.js.map +0 -1
- package/dist/lib/clipboard.js +0 -72
- package/dist/lib/clipboard.js.map +0 -1
- package/dist/lib/converters.js +0 -141
- package/dist/lib/converters.js.map +0 -1
- package/dist/lib/input.js +0 -52
- package/dist/lib/input.js.map +0 -1
- package/dist/lib/palette.js +0 -24
- package/dist/lib/palette.js.map +0 -1
- package/dist/lib/prevention.d.ts +0 -24
- package/dist/lib/prevention.d.ts.map +0 -1
- package/dist/lib/prevention.js +0 -82
- package/dist/lib/prevention.js.map +0 -1
- package/dist/lib/structs.js +0 -276
- package/dist/lib/structs.js.map +0 -1
- package/dist/lib/table.js +0 -1259
- package/dist/lib/table.js.map +0 -1
- package/dist/lib/time.js +0 -170
- package/dist/lib/time.js.map +0 -1
- package/dist/lib/virtualization.js +0 -129
- package/dist/lib/virtualization.js.map +0 -1
- package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js +0 -287
- package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js.map +0 -1
- package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/timezone.js +0 -72
- package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/timezone.js.map +0 -1
- package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/utc.js +0 -85
- package/dist/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/utc.js.map +0 -1
- package/dist/parsers/core.js +0 -111
- package/dist/parsers/core.js.map +0 -1
- package/dist/renderers/checkbox.js +0 -20
- package/dist/renderers/checkbox.js.map +0 -1
- package/dist/renderers/core.js +0 -135
- package/dist/renderers/core.js.map +0 -1
- package/dist/renderers/thousand_separator.js +0 -17
- package/dist/renderers/thousand_separator.js.map +0 -1
- package/dist/store/actions.js +0 -762
- package/dist/store/actions.js.map +0 -1
- package/dist/store/helpers.js +0 -88
- package/dist/store/helpers.js.map +0 -1
- package/dist/store/index.js +0 -8
- package/dist/store/index.js.map +0 -1
- package/dist/styles/embedder.js +0 -19
- package/dist/styles/embedder.js.map +0 -1
- package/dist/styles/minified.js +0 -7
- package/dist/styles/minified.js.map +0 -1
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { stripTable } from "./__utils.js";
|
|
3
|
-
class IfErrorFunction {
|
|
4
|
-
constructor({ args, table }) {
|
|
5
|
-
this.example = 'IFERROR(A1, "Error in cell A1")';
|
|
6
|
-
this.helpText = [
|
|
7
|
-
"Returns the first argument if it is not an error value, otherwise returns the second argument if present, or a blank if the second argument is absent."
|
|
8
|
-
];
|
|
9
|
-
this.helpArgs = [
|
|
10
|
-
{
|
|
11
|
-
name: "value",
|
|
12
|
-
description: "The value to return if value itself is not an error."
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: "value_if_error",
|
|
16
|
-
description: "The value the function returns if value is an error.",
|
|
17
|
-
optional: true
|
|
18
|
-
}
|
|
19
|
-
];
|
|
20
|
-
this.args = args;
|
|
21
|
-
this.table = table;
|
|
22
|
-
}
|
|
23
|
-
validate() {
|
|
24
|
-
if (this.args.length === 1 || this.args.length === 2) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
throw new FormulaError(
|
|
28
|
-
"#N/A",
|
|
29
|
-
"Number of arguments for IFERROR is incorrect. 1 or 2 argument(s) must be specified."
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
call() {
|
|
33
|
-
this.validate();
|
|
34
|
-
const [value, valueIfError] = this.args;
|
|
35
|
-
try {
|
|
36
|
-
return stripTable(value.evaluate({ table: this.table }));
|
|
37
|
-
} catch (e) {
|
|
38
|
-
return stripTable(valueIfError == null ? void 0 : valueIfError.evaluate({ table: this.table }));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
export {
|
|
43
|
-
IfErrorFunction
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=iferror.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"iferror.js","sources":["../../../formula/functions/iferror.ts"],"sourcesContent":["// DO NOT COPY THIS CODE FOR THE OTHER.\n\nimport { Table } from '../../lib/table';\nimport { Expression, FormulaError } from '../evaluator';\nimport { FunctionProps } from './__base';\nimport { stripTable } from './__utils';\n\nexport class IfErrorFunction {\n example = 'IFERROR(A1, \"Error in cell A1\")';\n helpText = [\n 'Returns the first argument if it is not an error value, otherwise returns the second argument if present, or a blank if the second argument is absent.',\n ];\n helpArgs = [\n {\n name: 'value',\n description: 'The value to return if value itself is not an error.',\n },\n {\n name: 'value_if_error',\n description: 'The value the function returns if value is an error.',\n optional: true,\n },\n ];\n private args: Expression[];\n private table: Table;\n\n constructor({ args, table }: FunctionProps) {\n this.args = args;\n this.table = table;\n }\n\n protected validate() {\n if (this.args.length === 1 || this.args.length === 2) {\n return;\n }\n throw new FormulaError(\n '#N/A',\n 'Number of arguments for IFERROR is incorrect. 1 or 2 argument(s) must be specified.',\n );\n }\n\n public call() {\n this.validate();\n const [value, valueIfError] = this.args;\n\n try {\n return stripTable(value.evaluate({ table: this.table }));\n } catch (e) {\n return stripTable(valueIfError?.evaluate({ table: this.table }));\n }\n }\n}\n"],"names":[],"mappings":";;AAOO,MAAM,gBAAgB;AAAA,EAmB3B,YAAY,EAAE,MAAM,SAAwB;AAlBlC,SAAA,UAAA;AACC,SAAA,WAAA;AAAA,MACT;AAAA,IACF;AACW,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,UAAU;AAAA,MAAA;AAAA,IAEd;AAKE,SAAK,OAAO;AACZ,SAAK,QAAQ;AAAA,EAAA;AAAA,EAGL,WAAW;AACnB,QAAI,KAAK,KAAK,WAAW,KAAK,KAAK,KAAK,WAAW,GAAG;AACpD;AAAA,IAAA;AAEF,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EAAA;AAAA,EAGK,OAAO;AACZ,SAAK,SAAS;AACd,UAAM,CAAC,OAAO,YAAY,IAAI,KAAK;AAE/B,QAAA;AACK,aAAA,WAAW,MAAM,SAAS,EAAE,OAAO,KAAK,MAAA,CAAO,CAAC;AAAA,aAChD,GAAG;AACH,aAAA,WAAW,6CAAc,SAAS,EAAE,OAAO,KAAK,MAAA,EAAQ;AAAA,IAAA;AAAA,EACjE;AAEJ;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"iferror.spec.d.ts","sourceRoot":"","sources":["../../../formula/functions/iferror.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { ensureString } from "./__utils.js";
|
|
4
|
-
class LenFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "LEN(A2)";
|
|
8
|
-
this.helpText = ["Returns the length of a string."];
|
|
9
|
-
this.helpArgs = [
|
|
10
|
-
{
|
|
11
|
-
name: "text",
|
|
12
|
-
description: "A text to be returned the length."
|
|
13
|
-
}
|
|
14
|
-
];
|
|
15
|
-
}
|
|
16
|
-
validate() {
|
|
17
|
-
if (this.bareArgs.length !== 1) {
|
|
18
|
-
throw new FormulaError("#N/A", "Number of arguments for LEN is incorrect.");
|
|
19
|
-
}
|
|
20
|
-
this.bareArgs = [ensureString(this.bareArgs[0])];
|
|
21
|
-
}
|
|
22
|
-
main(text) {
|
|
23
|
-
return text.length;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
LenFunction
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=len.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"len.js","sources":["../../../formula/functions/len.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureString } from './__utils';\n\nexport class LenFunction extends BaseFunction {\n example = 'LEN(A2)';\n helpText = ['Returns the length of a string.'];\n helpArgs = [\n {\n name: 'text',\n description: 'A text to be returned the length.',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for LEN is incorrect.');\n }\n this.bareArgs = [ensureString(this.bareArgs[0])];\n }\n\n protected main(text: string) {\n return text.length;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,iCAAiC;AAClC,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,IAEjB;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,2CAA2C;AAAA,IAAA;AAE5E,SAAK,WAAW,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC;AAAA,EAAA;AAAA,EAGvC,KAAK,MAAc;AAC3B,WAAO,KAAK;AAAA,EAAA;AAEhB;"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { ensureString } from "./__utils.js";
|
|
4
|
-
class LenbFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "LENB(A2)";
|
|
8
|
-
this.helpText = ["Returns the number of bytes in the length of the string."];
|
|
9
|
-
this.helpArgs = [
|
|
10
|
-
{
|
|
11
|
-
name: "text",
|
|
12
|
-
description: "A text to be returned the length of the bytes."
|
|
13
|
-
}
|
|
14
|
-
];
|
|
15
|
-
}
|
|
16
|
-
validate() {
|
|
17
|
-
if (this.bareArgs.length !== 1) {
|
|
18
|
-
throw new FormulaError("#N/A", "Number of arguments for LENB is incorrect.");
|
|
19
|
-
}
|
|
20
|
-
this.bareArgs = [ensureString(this.bareArgs[0])];
|
|
21
|
-
}
|
|
22
|
-
main(text) {
|
|
23
|
-
return encodeURIComponent(text).replace(/%../g, "x").length;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
LenbFunction
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=lenb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lenb.js","sources":["../../../formula/functions/lenb.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureString } from './__utils';\n\nexport class LenbFunction extends BaseFunction {\n example = 'LENB(A2)';\n helpText = ['Returns the number of bytes in the length of the string.'];\n helpArgs = [\n {\n name: 'text',\n description: 'A text to be returned the length of the bytes.',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for LENB is incorrect.');\n }\n this.bareArgs = [ensureString(this.bareArgs[0])];\n }\n\n protected main(text: string) {\n return encodeURIComponent(text).replace(/%../g, 'x').length;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,qBAAqB,aAAa;AAAA,EAAxC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,0DAA0D;AAC3D,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,IAEjB;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,4CAA4C;AAAA,IAAA;AAE7E,SAAK,WAAW,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC;AAAA,EAAA;AAAA,EAGvC,KAAK,MAAc;AAC3B,WAAO,mBAAmB,IAAI,EAAE,QAAQ,QAAQ,GAAG,EAAE;AAAA,EAAA;AAEzD;"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { ensureNumber } from "./__utils.js";
|
|
4
|
-
class LnFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "LN(100)";
|
|
8
|
-
this.helpText = ["Returns the logarithm of e"];
|
|
9
|
-
this.helpArgs = [
|
|
10
|
-
{
|
|
11
|
-
name: "value",
|
|
12
|
-
description: "The value for the logarithm of e"
|
|
13
|
-
}
|
|
14
|
-
];
|
|
15
|
-
}
|
|
16
|
-
validate() {
|
|
17
|
-
if (this.bareArgs.length !== 1) {
|
|
18
|
-
throw new FormulaError("#N/A", "Number of arguments for LN is incorrect.");
|
|
19
|
-
}
|
|
20
|
-
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
21
|
-
if (this.bareArgs[0] <= 0) {
|
|
22
|
-
throw new FormulaError("NUM!", "value must be greater than 0");
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
main(value) {
|
|
26
|
-
return Math.log(value);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
LnFunction
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=ln.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ln.js","sources":["../../../formula/functions/ln.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class LnFunction extends BaseFunction {\n example = 'LN(100)';\n helpText = ['Returns the logarithm of e'];\n helpArgs = [\n {\n name: 'value',\n description: 'The value for the logarithm of e',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for LN is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n if (this.bareArgs[0] <= 0) {\n throw new FormulaError('NUM!', 'value must be greater than 0');\n }\n }\n\n protected main(value: number) {\n return Math.log(value);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,mBAAmB,aAAa;AAAA,EAAtC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,4BAA4B;AAC7B,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,IAEjB;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,0CAA0C;AAAA,IAAA;AAEtE,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAC5D,QAAI,KAAK,SAAS,CAAC,KAAK,GAAG;AACnB,YAAA,IAAI,aAAa,QAAQ,8BAA8B;AAAA,IAAA;AAAA,EAC/D;AAAA,EAGQ,KAAK,OAAe;AACrB,WAAA,KAAK,IAAI,KAAK;AAAA,EAAA;AAEzB;"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { ensureNumber } from "./__utils.js";
|
|
4
|
-
class LogFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "LOG(128, 2)";
|
|
8
|
-
this.helpText = ["Returns the logarithm of a number whose base is the specified number."];
|
|
9
|
-
this.helpArgs = [
|
|
10
|
-
{
|
|
11
|
-
name: "value",
|
|
12
|
-
description: "The value for the logarithm of the specified number as base."
|
|
13
|
-
},
|
|
14
|
-
{ name: "base", description: "An exponent to power the base." }
|
|
15
|
-
];
|
|
16
|
-
}
|
|
17
|
-
validate() {
|
|
18
|
-
if (this.bareArgs.length !== 2) {
|
|
19
|
-
throw new FormulaError("#N/A", "Number of arguments for LOG is incorrect.");
|
|
20
|
-
}
|
|
21
|
-
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
22
|
-
if (this.bareArgs[0] <= 0) {
|
|
23
|
-
throw new FormulaError("NUM!", "value must be greater than 0");
|
|
24
|
-
}
|
|
25
|
-
if (this.bareArgs[1] <= 1) {
|
|
26
|
-
throw new FormulaError("NUM!", "base must be greater than 1");
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
main(value, base) {
|
|
30
|
-
return Math.log2(value) / Math.log2(base);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
LogFunction
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=log.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sources":["../../../formula/functions/log.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class LogFunction extends BaseFunction {\n example = 'LOG(128, 2)';\n helpText = ['Returns the logarithm of a number whose base is the specified number.'];\n helpArgs = [\n {\n name: 'value',\n description: 'The value for the logarithm of the specified number as base.',\n },\n { name: 'base', description: 'An exponent to power the base.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for LOG is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n if (this.bareArgs[0] <= 0) {\n throw new FormulaError('NUM!', 'value must be greater than 0');\n }\n if (this.bareArgs[1] <= 1) {\n throw new FormulaError('NUM!', 'base must be greater than 1');\n }\n }\n\n protected main(value: number, base: number) {\n return Math.log2(value) / Math.log2(base);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,uEAAuE;AACxE,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA,EAAE,MAAM,QAAQ,aAAa,iCAAiC;AAAA,IAChE;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,2CAA2C;AAAA,IAAA;AAEvE,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAC5D,QAAI,KAAK,SAAS,CAAC,KAAK,GAAG;AACnB,YAAA,IAAI,aAAa,QAAQ,8BAA8B;AAAA,IAAA;AAE/D,QAAI,KAAK,SAAS,CAAC,KAAK,GAAG;AACnB,YAAA,IAAI,aAAa,QAAQ,6BAA6B;AAAA,IAAA;AAAA,EAC9D;AAAA,EAGQ,KAAK,OAAe,MAAc;AAC1C,WAAO,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,IAAI;AAAA,EAAA;AAE5C;"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { ensureNumber } from "./__utils.js";
|
|
4
|
-
class Log10Function extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "LOG10(100)";
|
|
8
|
-
this.helpText = ["Returns the logarithm of 10"];
|
|
9
|
-
this.helpArgs = [
|
|
10
|
-
{
|
|
11
|
-
name: "value",
|
|
12
|
-
description: "The value for the logarithm of 10"
|
|
13
|
-
}
|
|
14
|
-
];
|
|
15
|
-
}
|
|
16
|
-
validate() {
|
|
17
|
-
if (this.bareArgs.length !== 1) {
|
|
18
|
-
throw new FormulaError("#N/A", "Number of arguments for LOG10 is incorrect.");
|
|
19
|
-
}
|
|
20
|
-
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
21
|
-
if (this.bareArgs[0] <= 0) {
|
|
22
|
-
throw new FormulaError("NUM!", "value must be greater than 0");
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
main(value) {
|
|
26
|
-
return Math.log10(value);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
Log10Function
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=log10.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log10.js","sources":["../../../formula/functions/log10.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class Log10Function extends BaseFunction {\n example = 'LOG10(100)';\n helpText = ['Returns the logarithm of 10'];\n helpArgs = [\n {\n name: 'value',\n description: 'The value for the logarithm of 10',\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 1) {\n throw new FormulaError('#N/A', 'Number of arguments for LOG10 is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n if (this.bareArgs[0] <= 0) {\n throw new FormulaError('NUM!', 'value must be greater than 0');\n }\n }\n\n protected main(value: number) {\n return Math.log10(value);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,sBAAsB,aAAa;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,6BAA6B;AAC9B,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,IAEjB;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,6CAA6C;AAAA,IAAA;AAEzE,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAC5D,QAAI,KAAK,SAAS,CAAC,KAAK,GAAG;AACnB,YAAA,IAAI,aAAa,QAAQ,8BAA8B;AAAA,IAAA;AAAA,EAC/D;AAAA,EAGQ,KAAK,OAAe;AACrB,WAAA,KAAK,MAAM,KAAK;AAAA,EAAA;AAE3B;"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { lt } from "./__utils.js";
|
|
4
|
-
class LtFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "LT(3, 6)";
|
|
8
|
-
this.helpText = [
|
|
9
|
-
"Returns TRUE if the first argument is truely less than the second argument, FALSE otherwise.",
|
|
10
|
-
"This is the same as the '<' operator."
|
|
11
|
-
];
|
|
12
|
-
this.helpArgs = [
|
|
13
|
-
{ name: "value1", description: "First value." },
|
|
14
|
-
{ name: "value2", description: "A value to be compared with value1." }
|
|
15
|
-
];
|
|
16
|
-
}
|
|
17
|
-
validate() {
|
|
18
|
-
if (this.bareArgs.length !== 2) {
|
|
19
|
-
throw new FormulaError("#N/A", "Number of arguments for LT is incorrect.");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
main(v1, v2) {
|
|
23
|
-
return lt(v1, v2);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
LtFunction
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=lt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lt.js","sources":["../../../formula/functions/lt.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { lt } from './__utils';\n\nexport class LtFunction extends BaseFunction {\n example = 'LT(3, 6)';\n helpText = [\n 'Returns TRUE if the first argument is truely less than the second argument, FALSE otherwise.',\n \"This is the same as the '<' operator.\",\n ];\n helpArgs = [\n { name: 'value1', description: 'First value.' },\n { name: 'value2', description: 'A value to be compared with value1.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for LT is incorrect.');\n }\n }\n\n protected main(v1: number, v2: number) {\n return lt(v1, v2);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,mBAAmB,aAAa;AAAA,EAAtC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA;AAAA,MACT;AAAA,MACA;AAAA,IACF;AACW,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,eAAe;AAAA,MAC9C,EAAE,MAAM,UAAU,aAAa,sCAAsC;AAAA,IACvE;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,0CAA0C;AAAA,IAAA;AAAA,EAC3E;AAAA,EAGQ,KAAK,IAAY,IAAY;AAC9B,WAAA,GAAG,IAAI,EAAE;AAAA,EAAA;AAEpB;"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { lte } from "./__utils.js";
|
|
4
|
-
class LteFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "LTE(3, 6)";
|
|
8
|
-
this.helpText = [
|
|
9
|
-
"Returns TRUE if the first argument is less than the second argument, FALSE otherwise.",
|
|
10
|
-
"This is the same as the '<=' operator."
|
|
11
|
-
];
|
|
12
|
-
this.helpArgs = [
|
|
13
|
-
{ name: "value1", description: "First value." },
|
|
14
|
-
{ name: "value2", description: "A value to be compared with value1." }
|
|
15
|
-
];
|
|
16
|
-
}
|
|
17
|
-
validate() {
|
|
18
|
-
if (this.bareArgs.length !== 2) {
|
|
19
|
-
throw new FormulaError("#N/A", "Number of arguments for LTE is incorrect.");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
main(v1, v2) {
|
|
23
|
-
return lte(v1, v2);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
LteFunction
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=lte.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lte.js","sources":["../../../formula/functions/lte.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { lte } from './__utils';\n\nexport class LteFunction extends BaseFunction {\n example = 'LTE(3, 6)';\n helpText = [\n 'Returns TRUE if the first argument is less than the second argument, FALSE otherwise.',\n \"This is the same as the '<=' operator.\",\n ];\n helpArgs = [\n { name: 'value1', description: 'First value.' },\n { name: 'value2', description: 'A value to be compared with value1.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for LTE is incorrect.');\n }\n }\n\n protected main(v1: number, v2: number) {\n return lte(v1, v2);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA;AAAA,MACT;AAAA,MACA;AAAA,IACF;AACW,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,eAAe;AAAA,MAC9C,EAAE,MAAM,UAAU,aAAa,sCAAsC;AAAA,IACvE;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,2CAA2C;AAAA,IAAA;AAAA,EAC5E;AAAA,EAGQ,KAAK,IAAY,IAAY;AAC9B,WAAA,IAAI,IAAI,EAAE;AAAA,EAAA;AAErB;"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { solveTable } from "../solver.js";
|
|
3
|
-
import { Table } from "../../lib/table.js";
|
|
4
|
-
import { BaseFunction } from "./__base.js";
|
|
5
|
-
import { ensureNumber } from "./__utils.js";
|
|
6
|
-
class MaxFunction extends BaseFunction {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.example = "MAX(A2:A100, 101)";
|
|
10
|
-
this.helpText = ["Returns the max in 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
|
-
if (this.bareArgs.length === 0) {
|
|
23
|
-
throw new FormulaError("#N/A", "Number of arguments must be greater than 0.");
|
|
24
|
-
}
|
|
25
|
-
const spreaded = [];
|
|
26
|
-
this.bareArgs.map((arg) => {
|
|
27
|
-
if (arg instanceof Table) {
|
|
28
|
-
spreaded.push(
|
|
29
|
-
...solveTable({ table: arg }).reduce((a, b) => a.concat(b)).filter((v) => typeof v === "number")
|
|
30
|
-
);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
spreaded.push(ensureNumber(arg));
|
|
34
|
-
});
|
|
35
|
-
this.bareArgs = spreaded;
|
|
36
|
-
}
|
|
37
|
-
main(...values) {
|
|
38
|
-
if (values.length === 0) {
|
|
39
|
-
return 0;
|
|
40
|
-
}
|
|
41
|
-
return Math.max(...values);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
MaxFunction
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=max.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"max.js","sources":["../../../formula/functions/max.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { solveTable } from '../solver';\nimport { Table } from '../../lib/table';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class MaxFunction extends BaseFunction {\n example = 'MAX(A2:A100, 101)';\n helpText = ['Returns the max in a series of numbers or cells.'];\n helpArgs = [\n { name: 'value1', description: 'First number or range.' },\n {\n name: 'value2',\n description: 'Additional numbers or ranges',\n optional: true,\n iterable: true,\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length === 0) {\n throw new FormulaError('#N/A', 'Number of arguments must be greater than 0.');\n }\n const spreaded: number[] = [];\n this.bareArgs.map((arg) => {\n if (arg instanceof Table) {\n spreaded.push(\n ...solveTable({ table: arg })\n .reduce((a, b) => a.concat(b))\n .filter((v: any) => typeof v === 'number'),\n );\n return;\n }\n spreaded.push(ensureNumber(arg));\n });\n this.bareArgs = spreaded;\n }\n\n protected main(...values: number[]) {\n if (values.length === 0) {\n return 0;\n }\n return Math.max(...values);\n }\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,kDAAkD;AACnD,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,yBAAyB;AAAA,MACxD;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,UAAU;AAAA,QACV,UAAU;AAAA,MAAA;AAAA,IAEd;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,6CAA6C;AAAA,IAAA;AAE9E,UAAM,WAAqB,CAAC;AACvB,SAAA,SAAS,IAAI,CAAC,QAAQ;AACzB,UAAI,eAAe,OAAO;AACf,iBAAA;AAAA,UACP,GAAG,WAAW,EAAE,OAAO,IAAK,CAAA,EACzB,OAAO,CAAC,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,EAC5B,OAAO,CAAC,MAAW,OAAO,MAAM,QAAQ;AAAA,QAC7C;AACA;AAAA,MAAA;AAEO,eAAA,KAAK,aAAa,GAAG,CAAC;AAAA,IAAA,CAChC;AACD,SAAK,WAAW;AAAA,EAAA;AAAA,EAGR,QAAQ,QAAkB;AAC9B,QAAA,OAAO,WAAW,GAAG;AAChB,aAAA;AAAA,IAAA;AAEF,WAAA,KAAK,IAAI,GAAG,MAAM;AAAA,EAAA;AAE7B;"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { solveTable } from "../solver.js";
|
|
3
|
-
import { Table } from "../../lib/table.js";
|
|
4
|
-
import { BaseFunction } from "./__base.js";
|
|
5
|
-
import { ensureNumber } from "./__utils.js";
|
|
6
|
-
class MinFunction extends BaseFunction {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.example = "MIN(A2:A100, 101)";
|
|
10
|
-
this.helpText = ["Returns the min in 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
|
-
if (this.bareArgs.length === 0) {
|
|
23
|
-
throw new FormulaError("#N/A", "Number of arguments must be greater than 0.");
|
|
24
|
-
}
|
|
25
|
-
const spreaded = [];
|
|
26
|
-
this.bareArgs.map((arg) => {
|
|
27
|
-
if (arg instanceof Table) {
|
|
28
|
-
spreaded.push(
|
|
29
|
-
...solveTable({ table: arg }).reduce((a, b) => a.concat(b)).filter((v) => typeof v === "number")
|
|
30
|
-
);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
spreaded.push(ensureNumber(arg));
|
|
34
|
-
});
|
|
35
|
-
this.bareArgs = spreaded;
|
|
36
|
-
}
|
|
37
|
-
main(...values) {
|
|
38
|
-
if (values.length === 0) {
|
|
39
|
-
return 0;
|
|
40
|
-
}
|
|
41
|
-
return Math.min(...values);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
MinFunction
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"min.js","sources":["../../../formula/functions/min.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { solveTable } from '../solver';\nimport { Table } from '../../lib/table';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class MinFunction extends BaseFunction {\n example = 'MIN(A2:A100, 101)';\n helpText = ['Returns the min in a series of numbers or cells.'];\n helpArgs = [\n { name: 'value1', description: 'First number or range.' },\n {\n name: 'value2',\n description: 'Additional numbers or ranges',\n optional: true,\n iterable: true,\n },\n ];\n\n protected validate() {\n if (this.bareArgs.length === 0) {\n throw new FormulaError('#N/A', 'Number of arguments must be greater than 0.');\n }\n const spreaded: number[] = [];\n this.bareArgs.map((arg) => {\n if (arg instanceof Table) {\n spreaded.push(\n ...solveTable({ table: arg })\n .reduce((a, b) => a.concat(b))\n .filter((v: any) => typeof v === 'number'),\n );\n return;\n }\n spreaded.push(ensureNumber(arg));\n });\n this.bareArgs = spreaded;\n }\n\n protected main(...values: number[]) {\n if (values.length === 0) {\n return 0;\n }\n return Math.min(...values);\n }\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,kDAAkD;AACnD,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,yBAAyB;AAAA,MACxD;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,UAAU;AAAA,QACV,UAAU;AAAA,MAAA;AAAA,IAEd;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,6CAA6C;AAAA,IAAA;AAE9E,UAAM,WAAqB,CAAC;AACvB,SAAA,SAAS,IAAI,CAAC,QAAQ;AACzB,UAAI,eAAe,OAAO;AACf,iBAAA;AAAA,UACP,GAAG,WAAW,EAAE,OAAO,IAAK,CAAA,EACzB,OAAO,CAAC,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,EAC5B,OAAO,CAAC,MAAW,OAAO,MAAM,QAAQ;AAAA,QAC7C;AACA;AAAA,MAAA;AAEO,eAAA,KAAK,aAAa,GAAG,CAAC;AAAA,IAAA,CAChC;AACD,SAAK,WAAW;AAAA,EAAA;AAAA,EAGR,QAAQ,QAAkB;AAC9B,QAAA,OAAO,WAAW,GAAG;AAChB,aAAA;AAAA,IAAA;AAEF,WAAA,KAAK,IAAI,GAAG,MAAM;AAAA,EAAA;AAE7B;"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import dayjs from "../../_virtual/dayjs.min.js";
|
|
2
|
-
import { FormulaError } from "../evaluator.js";
|
|
3
|
-
import { TimeDelta } from "../../lib/time.js";
|
|
4
|
-
import { BaseFunction } from "./__base.js";
|
|
5
|
-
import { stripTable, ensureNumber } from "./__utils.js";
|
|
6
|
-
import { Table } from "../../lib/table.js";
|
|
7
|
-
import { SECONDS_IN_DAY } from "../../constants.js";
|
|
8
|
-
class MinusFunction extends BaseFunction {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.example = "MINUS(8, 3)";
|
|
12
|
-
this.helpText = ["Returns the difference of two numbers.", "This is the same as the '-' operator."];
|
|
13
|
-
this.helpArgs = [
|
|
14
|
-
{ name: "value1", description: "A number that will be subtracted." },
|
|
15
|
-
{ name: "value2", description: "A number that will subtract from value1." }
|
|
16
|
-
];
|
|
17
|
-
}
|
|
18
|
-
validate() {
|
|
19
|
-
if (this.bareArgs.length !== 2) {
|
|
20
|
-
throw new FormulaError("#N/A", "Number of arguments for MINUS is incorrect.");
|
|
21
|
-
}
|
|
22
|
-
this.bareArgs = this.bareArgs.map((arg) => {
|
|
23
|
-
if (arg instanceof Table) {
|
|
24
|
-
arg = stripTable(arg, 0, 0);
|
|
25
|
-
}
|
|
26
|
-
return typeof arg === "object" ? arg : ensureNumber(arg);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
main(v1, v2) {
|
|
30
|
-
if (typeof v1 === "number" && typeof v2 === "number") {
|
|
31
|
-
return v1 - v2;
|
|
32
|
-
}
|
|
33
|
-
if (v1 instanceof Date && v2 instanceof Date) {
|
|
34
|
-
return new TimeDelta(v1, v2);
|
|
35
|
-
}
|
|
36
|
-
if (v1 instanceof Date && TimeDelta.is(v2)) {
|
|
37
|
-
return TimeDelta.ensure(v2).sub(v1);
|
|
38
|
-
}
|
|
39
|
-
if (TimeDelta.is(v1) && v2 instanceof Date) {
|
|
40
|
-
return TimeDelta.ensure(v1).sub(v2);
|
|
41
|
-
}
|
|
42
|
-
if (v1 instanceof Date && typeof v2 === "number") {
|
|
43
|
-
return dayjs(v1).subtract(v2 * SECONDS_IN_DAY, "second").toDate();
|
|
44
|
-
}
|
|
45
|
-
if (!v1) {
|
|
46
|
-
return -v2;
|
|
47
|
-
}
|
|
48
|
-
if (!v2) {
|
|
49
|
-
return v1;
|
|
50
|
-
}
|
|
51
|
-
throw new FormulaError("#VALUE!", "Mismatched types for minuend and subtrahend.");
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
export {
|
|
55
|
-
MinusFunction
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=minus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"minus.js","sources":["../../../formula/functions/minus.ts"],"sourcesContent":["import dayjs from 'dayjs';\n\nimport { FormulaError } from '../evaluator';\nimport { TimeDelta } from '../../lib/time';\nimport { BaseFunction } from './__base';\nimport { ensureNumber, stripTable } from './__utils';\nimport { Table } from '../../lib/table';\nimport { SECONDS_IN_DAY } from '../../constants';\n\nexport class MinusFunction extends BaseFunction {\n example = 'MINUS(8, 3)';\n helpText = ['Returns the difference of two numbers.', \"This is the same as the '-' operator.\"];\n helpArgs = [\n { name: 'value1', description: 'A number that will be subtracted.' },\n { name: 'value2', description: 'A number that will subtract from value1.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for MINUS is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => {\n if (arg instanceof Table) {\n arg = stripTable(arg, 0, 0);\n }\n return typeof arg === 'object' ? arg : ensureNumber(arg);\n });\n }\n\n protected main(v1: number | Date | TimeDelta, v2: number | Date | TimeDelta) {\n if (typeof v1 === 'number' && typeof v2 === 'number') {\n return v1 - v2;\n }\n if (v1 instanceof Date && v2 instanceof Date) {\n return new TimeDelta(v1, v2);\n }\n if (v1 instanceof Date && TimeDelta.is(v2)) {\n return TimeDelta.ensure(v2).sub(v1);\n }\n if (TimeDelta.is(v1) && v2 instanceof Date) {\n return TimeDelta.ensure(v1).sub(v2);\n }\n if (v1 instanceof Date && typeof v2 === 'number') {\n return dayjs(v1)\n .subtract(v2 * SECONDS_IN_DAY, 'second')\n .toDate();\n }\n if (!v1) {\n return -v2;\n }\n if (!v2) {\n return v1;\n }\n throw new FormulaError('#VALUE!', 'Mismatched types for minuend and subtrahend.');\n }\n}\n"],"names":[],"mappings":";;;;;;;AASO,MAAM,sBAAsB,aAAa;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA,CAAC,0CAA0C,uCAAuC;AAClF,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,oCAAoC;AAAA,MACnE,EAAE,MAAM,UAAU,aAAa,2CAA2C;AAAA,IAC5E;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,6CAA6C;AAAA,IAAA;AAE9E,SAAK,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ;AACzC,UAAI,eAAe,OAAO;AAClB,cAAA,WAAW,KAAK,GAAG,CAAC;AAAA,MAAA;AAE5B,aAAO,OAAO,QAAQ,WAAW,MAAM,aAAa,GAAG;AAAA,IAAA,CACxD;AAAA,EAAA;AAAA,EAGO,KAAK,IAA+B,IAA+B;AAC3E,QAAI,OAAO,OAAO,YAAY,OAAO,OAAO,UAAU;AACpD,aAAO,KAAK;AAAA,IAAA;AAEV,QAAA,cAAc,QAAQ,cAAc,MAAM;AACrC,aAAA,IAAI,UAAU,IAAI,EAAE;AAAA,IAAA;AAE7B,QAAI,cAAc,QAAQ,UAAU,GAAG,EAAE,GAAG;AAC1C,aAAO,UAAU,OAAO,EAAE,EAAE,IAAI,EAAE;AAAA,IAAA;AAEpC,QAAI,UAAU,GAAG,EAAE,KAAK,cAAc,MAAM;AAC1C,aAAO,UAAU,OAAO,EAAE,EAAE,IAAI,EAAE;AAAA,IAAA;AAEpC,QAAI,cAAc,QAAQ,OAAO,OAAO,UAAU;AACzC,aAAA,MAAM,EAAE,EACZ,SAAS,KAAK,gBAAgB,QAAQ,EACtC,OAAO;AAAA,IAAA;AAEZ,QAAI,CAAC,IAAI;AACP,aAAO,CAAC;AAAA,IAAA;AAEV,QAAI,CAAC,IAAI;AACA,aAAA;AAAA,IAAA;AAEH,UAAA,IAAI,aAAa,WAAW,8CAA8C;AAAA,EAAA;AAEpF;"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { ensureNumber } from "./__utils.js";
|
|
4
|
-
class ModFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "MOD(10, 4)";
|
|
8
|
-
this.helpText = ["Returns the result of the modulo operation."];
|
|
9
|
-
this.helpArgs = [
|
|
10
|
-
{
|
|
11
|
-
name: "dividend",
|
|
12
|
-
description: "A number that will be divided by divisor."
|
|
13
|
-
},
|
|
14
|
-
{ name: "divisor", description: "A number that will divide a dividend." }
|
|
15
|
-
];
|
|
16
|
-
}
|
|
17
|
-
validate() {
|
|
18
|
-
if (this.bareArgs.length !== 2) {
|
|
19
|
-
throw new FormulaError("#N/A", "Number of arguments for MOD is incorrect.");
|
|
20
|
-
}
|
|
21
|
-
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
22
|
-
if (this.bareArgs[1] === 0) {
|
|
23
|
-
throw new FormulaError("#DIV/0!", "The second argument must be non-zero.");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
main(v1, v2) {
|
|
27
|
-
return (v1 % v2 + v2) % v2;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
ModFunction
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=mod.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sources":["../../../formula/functions/mod.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class ModFunction extends BaseFunction {\n example = 'MOD(10, 4)';\n helpText = ['Returns the result of the modulo operation.'];\n helpArgs = [\n {\n name: 'dividend',\n description: 'A number that will be divided by divisor.',\n },\n { name: 'divisor', description: 'A number that will divide a dividend.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for MOD is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n if (this.bareArgs[1] === 0) {\n throw new FormulaError('#DIV/0!', 'The second argument must be non-zero.');\n }\n }\n\n protected main(v1: number, v2: number) {\n // https://stackoverflow.com/questions/4467539/javascript-modulo-gives-a-negative-result-for-negative-numbers\n return ((v1 % v2) + v2) % v2;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oBAAoB,aAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACV,SAAA,WAAW,CAAC,6CAA6C;AAC9C,SAAA,WAAA;AAAA,MACT;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA,EAAE,MAAM,WAAW,aAAa,wCAAwC;AAAA,IAC1E;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,2CAA2C;AAAA,IAAA;AAEvE,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAC5D,QAAI,KAAK,SAAS,CAAC,MAAM,GAAG;AACpB,YAAA,IAAI,aAAa,WAAW,uCAAuC;AAAA,IAAA;AAAA,EAC3E;AAAA,EAGQ,KAAK,IAAY,IAAY;AAE5B,YAAA,KAAK,KAAM,MAAM;AAAA,EAAA;AAE9B;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.spec.d.ts","sourceRoot":"","sources":["../../../formula/functions/mod.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { ensureNumber } from "./__utils.js";
|
|
4
|
-
class MultiplyFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "MULTIPLY(6, 7)";
|
|
8
|
-
this.helpText = ["Returns the product of two numbers.", "This is the same as the '*' operator."];
|
|
9
|
-
this.helpArgs = [
|
|
10
|
-
{ name: "factor1", description: "First factor." },
|
|
11
|
-
{ name: "factor2", description: "Second factor." }
|
|
12
|
-
];
|
|
13
|
-
}
|
|
14
|
-
validate() {
|
|
15
|
-
if (this.bareArgs.length !== 2) {
|
|
16
|
-
throw new FormulaError("#N/A", "Number of arguments for MULTIPLY is incorrect.");
|
|
17
|
-
}
|
|
18
|
-
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
19
|
-
}
|
|
20
|
-
main(v1, v2) {
|
|
21
|
-
return v1 * v2;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
MultiplyFunction
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=multiply.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multiply.js","sources":["../../../formula/functions/multiply.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ensureNumber } from './__utils';\n\nexport class MultiplyFunction extends BaseFunction {\n example = 'MULTIPLY(6, 7)';\n helpText = ['Returns the product of two numbers.', \"This is the same as the '*' operator.\"];\n helpArgs = [\n { name: 'factor1', description: 'First factor.' },\n { name: 'factor2', description: 'Second factor.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for MULTIPLY is incorrect.');\n }\n this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));\n }\n\n protected main(v1: number, v2: number) {\n return v1 * v2;\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,yBAAyB,aAAa;AAAA,EAA5C,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA,CAAC,uCAAuC,uCAAuC;AAC/E,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,WAAW,aAAa,gBAAgB;AAAA,MAChD,EAAE,MAAM,WAAW,aAAa,iBAAiB;AAAA,IACnD;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,gDAAgD;AAAA,IAAA;AAE5E,SAAA,WAAW,KAAK,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,CAAC;AAAA,EAAA;AAAA,EAGpD,KAAK,IAAY,IAAY;AACrC,WAAO,KAAK;AAAA,EAAA;AAEhB;"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { FormulaError } from "../evaluator.js";
|
|
2
|
-
import { BaseFunction } from "./__base.js";
|
|
3
|
-
import { ne } from "./__utils.js";
|
|
4
|
-
class NeFunction extends BaseFunction {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.example = "NE(6, 7)";
|
|
8
|
-
this.helpText = [
|
|
9
|
-
"Returns TRUE if the two specified values are not equal, FALSE if they are.",
|
|
10
|
-
"This is the same as the '<>' operator."
|
|
11
|
-
];
|
|
12
|
-
this.helpArgs = [
|
|
13
|
-
{ name: "value1", description: "First value." },
|
|
14
|
-
{ name: "value2", description: "A value to be compared with value1." }
|
|
15
|
-
];
|
|
16
|
-
}
|
|
17
|
-
validate() {
|
|
18
|
-
if (this.bareArgs.length !== 2) {
|
|
19
|
-
throw new FormulaError("#N/A", "Number of arguments for NE is incorrect.");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
main(v1, v2) {
|
|
23
|
-
return ne(v1, v2);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
NeFunction
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=ne.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ne.js","sources":["../../../formula/functions/ne.ts"],"sourcesContent":["import { FormulaError } from '../evaluator';\nimport { BaseFunction } from './__base';\nimport { ne } from './__utils';\n\nexport class NeFunction extends BaseFunction {\n example = 'NE(6, 7)';\n helpText = [\n 'Returns TRUE if the two specified values are not equal, FALSE if they are.',\n \"This is the same as the '<>' operator.\",\n ];\n helpArgs = [\n { name: 'value1', description: 'First value.' },\n { name: 'value2', description: 'A value to be compared with value1.' },\n ];\n\n protected validate() {\n if (this.bareArgs.length !== 2) {\n throw new FormulaError('#N/A', 'Number of arguments for NE is incorrect.');\n }\n }\n\n protected main(v1: number, v2: number) {\n return ne(v1, v2);\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,mBAAmB,aAAa;AAAA,EAAtC,cAAA;AAAA,UAAA,GAAA,SAAA;AACK,SAAA,UAAA;AACC,SAAA,WAAA;AAAA,MACT;AAAA,MACA;AAAA,IACF;AACW,SAAA,WAAA;AAAA,MACT,EAAE,MAAM,UAAU,aAAa,eAAe;AAAA,MAC9C,EAAE,MAAM,UAAU,aAAa,sCAAsC;AAAA,IACvE;AAAA,EAAA;AAAA,EAEU,WAAW;AACf,QAAA,KAAK,SAAS,WAAW,GAAG;AACxB,YAAA,IAAI,aAAa,QAAQ,0CAA0C;AAAA,IAAA;AAAA,EAC3E;AAAA,EAGQ,KAAK,IAAY,IAAY;AAC9B,WAAA,GAAG,IAAI,EAAE;AAAA,EAAA;AAEpB;"}
|