@nordcraft/std-lib 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (348) hide show
  1. package/README.md +5 -0
  2. package/dist/actions/clearLocalStorage/handler.d.ts +3 -0
  3. package/dist/actions/clearLocalStorage/handler.js +5 -0
  4. package/dist/actions/clearLocalStorage/handler.js.map +1 -0
  5. package/dist/actions/clearSessionStorage/handler.d.ts +3 -0
  6. package/dist/actions/clearSessionStorage/handler.js +5 -0
  7. package/dist/actions/clearSessionStorage/handler.js.map +1 -0
  8. package/dist/actions/copyToClipboard/handler.d.ts +3 -0
  9. package/dist/actions/copyToClipboard/handler.js +8 -0
  10. package/dist/actions/copyToClipboard/handler.js.map +1 -0
  11. package/dist/actions/deleteFromLocalStorage/handler.d.ts +3 -0
  12. package/dist/actions/deleteFromLocalStorage/handler.js +8 -0
  13. package/dist/actions/deleteFromLocalStorage/handler.js.map +1 -0
  14. package/dist/actions/deleteFromSessionStorage/handler.d.ts +3 -0
  15. package/dist/actions/deleteFromSessionStorage/handler.js +8 -0
  16. package/dist/actions/deleteFromSessionStorage/handler.js.map +1 -0
  17. package/dist/actions/focus/handler.d.ts +3 -0
  18. package/dist/actions/focus/handler.js +7 -0
  19. package/dist/actions/focus/handler.js.map +1 -0
  20. package/dist/actions/gotToURL/handler.d.ts +3 -0
  21. package/dist/actions/gotToURL/handler.js +13 -0
  22. package/dist/actions/gotToURL/handler.js.map +1 -0
  23. package/dist/actions/interval/handler.d.ts +3 -0
  24. package/dist/actions/interval/handler.js +14 -0
  25. package/dist/actions/interval/handler.js.map +1 -0
  26. package/dist/actions/logToConsole/handler.d.ts +3 -0
  27. package/dist/actions/logToConsole/handler.js +6 -0
  28. package/dist/actions/logToConsole/handler.js.map +1 -0
  29. package/dist/actions/preventDefault/handler.d.ts +3 -0
  30. package/dist/actions/preventDefault/handler.js +6 -0
  31. package/dist/actions/preventDefault/handler.js.map +1 -0
  32. package/dist/actions/saveToLocalStorage/handler.d.ts +3 -0
  33. package/dist/actions/saveToLocalStorage/handler.js +8 -0
  34. package/dist/actions/saveToLocalStorage/handler.js.map +1 -0
  35. package/dist/actions/saveToSessionStorage/handler.d.ts +3 -0
  36. package/dist/actions/saveToSessionStorage/handler.js +8 -0
  37. package/dist/actions/saveToSessionStorage/handler.js.map +1 -0
  38. package/dist/actions/setSessionCookies/handler.d.ts +3 -0
  39. package/dist/actions/setSessionCookies/handler.js +19 -0
  40. package/dist/actions/setSessionCookies/handler.js.map +1 -0
  41. package/dist/actions/share/handler.d.ts +3 -0
  42. package/dist/actions/share/handler.js +23 -0
  43. package/dist/actions/share/handler.js.map +1 -0
  44. package/dist/actions/sleep/handler.d.ts +3 -0
  45. package/dist/actions/sleep/handler.js +14 -0
  46. package/dist/actions/sleep/handler.js.map +1 -0
  47. package/dist/actions/stopPropagation/handler.d.ts +3 -0
  48. package/dist/actions/stopPropagation/handler.js +6 -0
  49. package/dist/actions/stopPropagation/handler.js.map +1 -0
  50. package/dist/actions.d.ts +17 -0
  51. package/dist/actions.js +18 -0
  52. package/dist/actions.js.map +1 -0
  53. package/dist/formulas/absolute/handler.d.ts +3 -0
  54. package/dist/formulas/absolute/handler.js +9 -0
  55. package/dist/formulas/absolute/handler.js.map +1 -0
  56. package/dist/formulas/add/handler.d.ts +3 -0
  57. package/dist/formulas/add/handler.js +12 -0
  58. package/dist/formulas/add/handler.js.map +1 -0
  59. package/dist/formulas/append/handler.d.ts +3 -0
  60. package/dist/formulas/append/handler.js +9 -0
  61. package/dist/formulas/append/handler.js.map +1 -0
  62. package/dist/formulas/boolean/handler.d.ts +3 -0
  63. package/dist/formulas/boolean/handler.js +6 -0
  64. package/dist/formulas/boolean/handler.js.map +1 -0
  65. package/dist/formulas/branchName/handler.d.ts +3 -0
  66. package/dist/formulas/branchName/handler.js +5 -0
  67. package/dist/formulas/branchName/handler.js.map +1 -0
  68. package/dist/formulas/canShare/handler.d.ts +3 -0
  69. package/dist/formulas/canShare/handler.js +24 -0
  70. package/dist/formulas/canShare/handler.js.map +1 -0
  71. package/dist/formulas/capitalize/handler.d.ts +3 -0
  72. package/dist/formulas/capitalize/handler.js +12 -0
  73. package/dist/formulas/capitalize/handler.js.map +1 -0
  74. package/dist/formulas/clamp/handler.d.ts +3 -0
  75. package/dist/formulas/clamp/handler.js +17 -0
  76. package/dist/formulas/clamp/handler.js.map +1 -0
  77. package/dist/formulas/concatenate/handler.d.ts +3 -0
  78. package/dist/formulas/concatenate/handler.js +16 -0
  79. package/dist/formulas/concatenate/handler.js.map +1 -0
  80. package/dist/formulas/currentURL/handler.d.ts +3 -0
  81. package/dist/formulas/currentURL/handler.js +3 -0
  82. package/dist/formulas/currentURL/handler.js.map +1 -0
  83. package/dist/formulas/dateFromString/handler.d.ts +3 -0
  84. package/dist/formulas/dateFromString/handler.js +11 -0
  85. package/dist/formulas/dateFromString/handler.js.map +1 -0
  86. package/dist/formulas/dateFromTimestamp/handler.d.ts +3 -0
  87. package/dist/formulas/dateFromTimestamp/handler.js +11 -0
  88. package/dist/formulas/dateFromTimestamp/handler.js.map +1 -0
  89. package/dist/formulas/decodeBase64/handler.d.ts +3 -0
  90. package/dist/formulas/decodeBase64/handler.js +9 -0
  91. package/dist/formulas/decodeBase64/handler.js.map +1 -0
  92. package/dist/formulas/decodeURIComponent/handler.d.ts +3 -0
  93. package/dist/formulas/decodeURIComponent/handler.js +9 -0
  94. package/dist/formulas/decodeURIComponent/handler.js.map +1 -0
  95. package/dist/formulas/defaultTo/handler.d.ts +3 -0
  96. package/dist/formulas/defaultTo/handler.js +11 -0
  97. package/dist/formulas/defaultTo/handler.js.map +1 -0
  98. package/dist/formulas/deleteKey/handler.d.ts +3 -0
  99. package/dist/formulas/deleteKey/handler.js +39 -0
  100. package/dist/formulas/deleteKey/handler.js.map +1 -0
  101. package/dist/formulas/divide/handler.d.ts +3 -0
  102. package/dist/formulas/divide/handler.js +9 -0
  103. package/dist/formulas/divide/handler.js.map +1 -0
  104. package/dist/formulas/drop/handler.d.ts +3 -0
  105. package/dist/formulas/drop/handler.js +16 -0
  106. package/dist/formulas/drop/handler.js.map +1 -0
  107. package/dist/formulas/dropLast/handler.d.ts +3 -0
  108. package/dist/formulas/dropLast/handler.js +16 -0
  109. package/dist/formulas/dropLast/handler.js.map +1 -0
  110. package/dist/formulas/encodeBase64/handler.d.ts +3 -0
  111. package/dist/formulas/encodeBase64/handler.js +9 -0
  112. package/dist/formulas/encodeBase64/handler.js.map +1 -0
  113. package/dist/formulas/encodeJSON/handler.d.ts +3 -0
  114. package/dist/formulas/encodeJSON/handler.js +9 -0
  115. package/dist/formulas/encodeJSON/handler.js.map +1 -0
  116. package/dist/formulas/encodeURIComponent/handler.d.ts +3 -0
  117. package/dist/formulas/encodeURIComponent/handler.js +9 -0
  118. package/dist/formulas/encodeURIComponent/handler.js.map +1 -0
  119. package/dist/formulas/entries/handler.d.ts +6 -0
  120. package/dist/formulas/entries/handler.js +9 -0
  121. package/dist/formulas/entries/handler.js.map +1 -0
  122. package/dist/formulas/equals/handler.d.ts +3 -0
  123. package/dist/formulas/equals/handler.js +5 -0
  124. package/dist/formulas/equals/handler.js.map +1 -0
  125. package/dist/formulas/every/handler.d.ts +4 -0
  126. package/dist/formulas/every/handler.js +31 -0
  127. package/dist/formulas/every/handler.js.map +1 -0
  128. package/dist/formulas/filter/handler.d.ts +4 -0
  129. package/dist/formulas/filter/handler.js +34 -0
  130. package/dist/formulas/filter/handler.js.map +1 -0
  131. package/dist/formulas/find/handler.d.ts +4 -0
  132. package/dist/formulas/find/handler.js +31 -0
  133. package/dist/formulas/find/handler.js.map +1 -0
  134. package/dist/formulas/findIndex/handler.d.ts +4 -0
  135. package/dist/formulas/findIndex/handler.js +31 -0
  136. package/dist/formulas/findIndex/handler.js.map +1 -0
  137. package/dist/formulas/findLast/handler.d.ts +4 -0
  138. package/dist/formulas/findLast/handler.js +31 -0
  139. package/dist/formulas/findLast/handler.js.map +1 -0
  140. package/dist/formulas/first/handler.d.ts +3 -0
  141. package/dist/formulas/first/handler.js +9 -0
  142. package/dist/formulas/first/handler.js.map +1 -0
  143. package/dist/formulas/flatten/handler.d.ts +3 -0
  144. package/dist/formulas/flatten/handler.js +9 -0
  145. package/dist/formulas/flatten/handler.js.map +1 -0
  146. package/dist/formulas/formatDate/handler.d.ts +3 -0
  147. package/dist/formulas/formatDate/handler.js +69 -0
  148. package/dist/formulas/formatDate/handler.js.map +1 -0
  149. package/dist/formulas/formatNumber/handler.d.ts +3 -0
  150. package/dist/formulas/formatNumber/handler.js +82 -0
  151. package/dist/formulas/formatNumber/handler.js.map +1 -0
  152. package/dist/formulas/fromEntries/handler.d.ts +3 -0
  153. package/dist/formulas/fromEntries/handler.js +13 -0
  154. package/dist/formulas/fromEntries/handler.js.map +1 -0
  155. package/dist/formulas/get/handler.d.ts +3 -0
  156. package/dist/formulas/get/handler.js +15 -0
  157. package/dist/formulas/get/handler.js.map +1 -0
  158. package/dist/formulas/getCookie/handler.d.ts +3 -0
  159. package/dist/formulas/getCookie/handler.js +19 -0
  160. package/dist/formulas/getCookie/handler.js.map +1 -0
  161. package/dist/formulas/getElementById/handler.d.ts +3 -0
  162. package/dist/formulas/getElementById/handler.js +9 -0
  163. package/dist/formulas/getElementById/handler.js.map +1 -0
  164. package/dist/formulas/getFromLocalStorage/handler.d.ts +3 -0
  165. package/dist/formulas/getFromLocalStorage/handler.js +21 -0
  166. package/dist/formulas/getFromLocalStorage/handler.js.map +1 -0
  167. package/dist/formulas/getFromSessionStorage/handler.d.ts +3 -0
  168. package/dist/formulas/getFromSessionStorage/handler.js +21 -0
  169. package/dist/formulas/getFromSessionStorage/handler.js.map +1 -0
  170. package/dist/formulas/getHttpOnlyCookie/handler.d.ts +3 -0
  171. package/dist/formulas/getHttpOnlyCookie/handler.js +9 -0
  172. package/dist/formulas/getHttpOnlyCookie/handler.js.map +1 -0
  173. package/dist/formulas/greaterOrEqueal/handler.d.ts +3 -0
  174. package/dist/formulas/greaterOrEqueal/handler.js +5 -0
  175. package/dist/formulas/greaterOrEqueal/handler.js.map +1 -0
  176. package/dist/formulas/greaterThan/handler.d.ts +3 -0
  177. package/dist/formulas/greaterThan/handler.js +5 -0
  178. package/dist/formulas/greaterThan/handler.js.map +1 -0
  179. package/dist/formulas/groupBy/handler.d.ts +4 -0
  180. package/dist/formulas/groupBy/handler.js +26 -0
  181. package/dist/formulas/groupBy/handler.js.map +1 -0
  182. package/dist/formulas/includes/handler.d.ts +3 -0
  183. package/dist/formulas/includes/handler.js +12 -0
  184. package/dist/formulas/includes/handler.js.map +1 -0
  185. package/dist/formulas/indexOf/handler.d.ts +3 -0
  186. package/dist/formulas/indexOf/handler.js +12 -0
  187. package/dist/formulas/indexOf/handler.js.map +1 -0
  188. package/dist/formulas/isServer/handler.d.ts +3 -0
  189. package/dist/formulas/isServer/handler.js +5 -0
  190. package/dist/formulas/isServer/handler.js.map +1 -0
  191. package/dist/formulas/join/handler.d.ts +3 -0
  192. package/dist/formulas/join/handler.js +9 -0
  193. package/dist/formulas/join/handler.js.map +1 -0
  194. package/dist/formulas/json/handler.d.ts +3 -0
  195. package/dist/formulas/json/handler.js +6 -0
  196. package/dist/formulas/json/handler.js.map +1 -0
  197. package/dist/formulas/keyBy/handler.d.ts +4 -0
  198. package/dist/formulas/keyBy/handler.js +35 -0
  199. package/dist/formulas/keyBy/handler.js.map +1 -0
  200. package/dist/formulas/languages/handler.d.ts +3 -0
  201. package/dist/formulas/languages/handler.js +12 -0
  202. package/dist/formulas/languages/handler.js.map +1 -0
  203. package/dist/formulas/last/handler.d.ts +3 -0
  204. package/dist/formulas/last/handler.js +9 -0
  205. package/dist/formulas/last/handler.js.map +1 -0
  206. package/dist/formulas/lastIndexOf/handler.d.ts +3 -0
  207. package/dist/formulas/lastIndexOf/handler.js +12 -0
  208. package/dist/formulas/lastIndexOf/handler.js.map +1 -0
  209. package/dist/formulas/lessOrEqual/handler.d.ts +3 -0
  210. package/dist/formulas/lessOrEqual/handler.js +5 -0
  211. package/dist/formulas/lessOrEqual/handler.js.map +1 -0
  212. package/dist/formulas/lessThan/handler.d.ts +3 -0
  213. package/dist/formulas/lessThan/handler.js +5 -0
  214. package/dist/formulas/lessThan/handler.js.map +1 -0
  215. package/dist/formulas/logarithm/handler.d.ts +3 -0
  216. package/dist/formulas/logarithm/handler.js +13 -0
  217. package/dist/formulas/logarithm/handler.js.map +1 -0
  218. package/dist/formulas/lowercase/handler.d.ts +3 -0
  219. package/dist/formulas/lowercase/handler.js +9 -0
  220. package/dist/formulas/lowercase/handler.js.map +1 -0
  221. package/dist/formulas/map/handler.d.ts +4 -0
  222. package/dist/formulas/map/handler.js +37 -0
  223. package/dist/formulas/map/handler.js.map +1 -0
  224. package/dist/formulas/matches/handler.d.ts +3 -0
  225. package/dist/formulas/matches/handler.js +15 -0
  226. package/dist/formulas/matches/handler.js.map +1 -0
  227. package/dist/formulas/max/handler.d.ts +3 -0
  228. package/dist/formulas/max/handler.js +5 -0
  229. package/dist/formulas/max/handler.js.map +1 -0
  230. package/dist/formulas/min/handler.d.ts +3 -0
  231. package/dist/formulas/min/handler.js +5 -0
  232. package/dist/formulas/min/handler.js.map +1 -0
  233. package/dist/formulas/minus/handler.d.ts +3 -0
  234. package/dist/formulas/minus/handler.js +11 -0
  235. package/dist/formulas/minus/handler.js.map +1 -0
  236. package/dist/formulas/modulo/handler.d.ts +3 -0
  237. package/dist/formulas/modulo/handler.js +8 -0
  238. package/dist/formulas/modulo/handler.js.map +1 -0
  239. package/dist/formulas/multiply/handler.d.ts +3 -0
  240. package/dist/formulas/multiply/handler.js +8 -0
  241. package/dist/formulas/multiply/handler.js.map +1 -0
  242. package/dist/formulas/not/handler.d.ts +3 -0
  243. package/dist/formulas/not/handler.js +4 -0
  244. package/dist/formulas/not/handler.js.map +1 -0
  245. package/dist/formulas/notEqual/handler.d.ts +3 -0
  246. package/dist/formulas/notEqual/handler.js +5 -0
  247. package/dist/formulas/notEqual/handler.js.map +1 -0
  248. package/dist/formulas/now/handler.d.ts +3 -0
  249. package/dist/formulas/now/handler.js +5 -0
  250. package/dist/formulas/now/handler.js.map +1 -0
  251. package/dist/formulas/number/handler.d.ts +3 -0
  252. package/dist/formulas/number/handler.js +3 -0
  253. package/dist/formulas/number/handler.js.map +1 -0
  254. package/dist/formulas/parseJSON/handler.d.ts +3 -0
  255. package/dist/formulas/parseJSON/handler.js +15 -0
  256. package/dist/formulas/parseJSON/handler.js.map +1 -0
  257. package/dist/formulas/parseURL/handler.d.ts +12 -0
  258. package/dist/formulas/parseURL/handler.js +27 -0
  259. package/dist/formulas/parseURL/handler.js.map +1 -0
  260. package/dist/formulas/power/handler.d.ts +3 -0
  261. package/dist/formulas/power/handler.js +8 -0
  262. package/dist/formulas/power/handler.js.map +1 -0
  263. package/dist/formulas/prepend/handler.d.ts +3 -0
  264. package/dist/formulas/prepend/handler.js +9 -0
  265. package/dist/formulas/prepend/handler.js.map +1 -0
  266. package/dist/formulas/randomNumber/handler.d.ts +3 -0
  267. package/dist/formulas/randomNumber/handler.js +5 -0
  268. package/dist/formulas/randomNumber/handler.js.map +1 -0
  269. package/dist/formulas/range/handler.d.ts +3 -0
  270. package/dist/formulas/range/handler.js +14 -0
  271. package/dist/formulas/range/handler.js.map +1 -0
  272. package/dist/formulas/reduce/handler.d.ts +4 -0
  273. package/dist/formulas/reduce/handler.js +45 -0
  274. package/dist/formulas/reduce/handler.js.map +1 -0
  275. package/dist/formulas/replaceAll/handler.d.ts +3 -0
  276. package/dist/formulas/replaceAll/handler.js +17 -0
  277. package/dist/formulas/replaceAll/handler.js.map +1 -0
  278. package/dist/formulas/reverse/handler.d.ts +3 -0
  279. package/dist/formulas/reverse/handler.js +9 -0
  280. package/dist/formulas/reverse/handler.js.map +1 -0
  281. package/dist/formulas/round/handler.d.ts +3 -0
  282. package/dist/formulas/round/handler.js +14 -0
  283. package/dist/formulas/round/handler.js.map +1 -0
  284. package/dist/formulas/roundDown/handler.d.ts +3 -0
  285. package/dist/formulas/roundDown/handler.js +14 -0
  286. package/dist/formulas/roundDown/handler.js.map +1 -0
  287. package/dist/formulas/roundUp/handler.d.ts +3 -0
  288. package/dist/formulas/roundUp/handler.js +14 -0
  289. package/dist/formulas/roundUp/handler.js.map +1 -0
  290. package/dist/formulas/set/handler.d.ts +3 -0
  291. package/dist/formulas/set/handler.js +22 -0
  292. package/dist/formulas/set/handler.js.map +1 -0
  293. package/dist/formulas/shuffle/handler.d.ts +3 -0
  294. package/dist/formulas/shuffle/handler.js +21 -0
  295. package/dist/formulas/shuffle/handler.js.map +1 -0
  296. package/dist/formulas/size/handler.d.ts +3 -0
  297. package/dist/formulas/size/handler.js +16 -0
  298. package/dist/formulas/size/handler.js.map +1 -0
  299. package/dist/formulas/some/handler.d.ts +4 -0
  300. package/dist/formulas/some/handler.js +31 -0
  301. package/dist/formulas/some/handler.js.map +1 -0
  302. package/dist/formulas/sort_by/handler.d.ts +4 -0
  303. package/dist/formulas/sort_by/handler.js +40 -0
  304. package/dist/formulas/sort_by/handler.js.map +1 -0
  305. package/dist/formulas/split/handler.d.ts +3 -0
  306. package/dist/formulas/split/handler.js +13 -0
  307. package/dist/formulas/split/handler.js.map +1 -0
  308. package/dist/formulas/squareRoot/handler.d.ts +3 -0
  309. package/dist/formulas/squareRoot/handler.js +9 -0
  310. package/dist/formulas/squareRoot/handler.js.map +1 -0
  311. package/dist/formulas/startsWith/handler.d.ts +3 -0
  312. package/dist/formulas/startsWith/handler.js +13 -0
  313. package/dist/formulas/startsWith/handler.js.map +1 -0
  314. package/dist/formulas/string/handler.d.ts +3 -0
  315. package/dist/formulas/string/handler.js +3 -0
  316. package/dist/formulas/string/handler.js.map +1 -0
  317. package/dist/formulas/sum/handler.d.ts +3 -0
  318. package/dist/formulas/sum/handler.js +17 -0
  319. package/dist/formulas/sum/handler.js.map +1 -0
  320. package/dist/formulas/take/handler.d.ts +3 -0
  321. package/dist/formulas/take/handler.js +16 -0
  322. package/dist/formulas/take/handler.js.map +1 -0
  323. package/dist/formulas/takeLast/handler.d.ts +3 -0
  324. package/dist/formulas/takeLast/handler.js +16 -0
  325. package/dist/formulas/takeLast/handler.js.map +1 -0
  326. package/dist/formulas/timestamp/handler.d.ts +3 -0
  327. package/dist/formulas/timestamp/handler.js +9 -0
  328. package/dist/formulas/timestamp/handler.js.map +1 -0
  329. package/dist/formulas/trim/handler.d.ts +3 -0
  330. package/dist/formulas/trim/handler.js +9 -0
  331. package/dist/formulas/trim/handler.js.map +1 -0
  332. package/dist/formulas/typeOf/handler.d.ts +3 -0
  333. package/dist/formulas/typeOf/handler.js +22 -0
  334. package/dist/formulas/typeOf/handler.js.map +1 -0
  335. package/dist/formulas/unique/handler.d.ts +3 -0
  336. package/dist/formulas/unique/handler.js +17 -0
  337. package/dist/formulas/unique/handler.js.map +1 -0
  338. package/dist/formulas/uppercase/handler.d.ts +3 -0
  339. package/dist/formulas/uppercase/handler.js +9 -0
  340. package/dist/formulas/uppercase/handler.js.map +1 -0
  341. package/dist/formulas/userAgent/handler.d.ts +3 -0
  342. package/dist/formulas/userAgent/handler.js +10 -0
  343. package/dist/formulas/userAgent/handler.js.map +1 -0
  344. package/dist/formulas.d.ts +98 -0
  345. package/dist/formulas.js +99 -0
  346. package/dist/formulas.js.map +1 -0
  347. package/dist/lib.ts +3360 -0
  348. package/package.json +21 -0
@@ -0,0 +1,69 @@
1
+ const handler = ([date, loc, opt]) => {
2
+ if (!date || !(date instanceof Date)) {
3
+ // throw new Error('Invalid input for Date')
4
+ return null;
5
+ }
6
+ const locales = typeof loc === 'string' && loc.length > 0
7
+ ? loc
8
+ : Array.isArray(loc) && loc.every((l) => typeof l === 'string')
9
+ ? loc
10
+ : undefined;
11
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
12
+ if (!opt || typeof opt !== 'object') {
13
+ return Intl.DateTimeFormat(locales).format(date);
14
+ }
15
+ const validateString = (value, allowedValues) => typeof value === 'string' && (allowedValues?.includes(value) ?? true)
16
+ ? value
17
+ : undefined;
18
+ const options = opt;
19
+ const dateStyle = validateString(options.dateStyle, ['full', 'long', 'medium', 'short']);
20
+ const timeStyle = validateString(options.timeStyle, ['full', 'long', 'medium', 'short']);
21
+ const calendar = validateString(options.calendar);
22
+ const weekday = validateString(options.weekday, ['long', 'short', 'narrow']);
23
+ const era = validateString(options.era, [
24
+ 'long',
25
+ 'short',
26
+ 'narrow',
27
+ ]);
28
+ const year = validateString(options.year, ['numeric', '2-digit']);
29
+ const month = validateString(options.month, ['long', 'short', 'narrow', 'numeric', '2-digit']);
30
+ const day = validateString(options.day, [
31
+ 'numeric',
32
+ '2-digit',
33
+ ]);
34
+ const hour = validateString(options.hour, ['numeric', '2-digit']);
35
+ const minute = validateString(options.minute, ['numeric', '2-digit']);
36
+ const second = validateString(options.second, ['numeric', '2-digit']);
37
+ const timeZoneName = validateString(options.timeZoneName, [
38
+ 'long',
39
+ 'short',
40
+ 'shortOffset',
41
+ 'longOffset',
42
+ 'shortGeneric',
43
+ 'longGeneric',
44
+ ]);
45
+ const timeZone = validateString(options.timeZone);
46
+ const hour12 = options.hour12 === true
47
+ ? true
48
+ : options.hour12 === false
49
+ ? false
50
+ : undefined;
51
+ return Intl.DateTimeFormat(locales, {
52
+ dateStyle,
53
+ timeStyle,
54
+ calendar,
55
+ weekday,
56
+ era,
57
+ year,
58
+ month,
59
+ day,
60
+ hour,
61
+ minute,
62
+ second,
63
+ timeZoneName,
64
+ timeZone,
65
+ hour12,
66
+ }).format(date);
67
+ };
68
+ export default handler;
69
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/formatDate/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA2B,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE;IAC3D,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,YAAY,IAAI,CAAC,EAAE,CAAC;QACrC,4CAA4C;QAC5C,OAAO,IAAI,CAA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;QACH,IAAI;QACJ,MAAM;QACN,MAAM;QACN,YAAY;QACZ,QAAQ;QACR,MAAM;KACP,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AACjB,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<string>;
3
+ export default handler;
@@ -0,0 +1,82 @@
1
+ const handler = ([input, loc, opt]) => {
2
+ if (typeof input !== 'number' || Number.isNaN(input)) {
3
+ return null;
4
+ }
5
+ const locales = typeof loc === 'string' && loc.length > 0
6
+ ? loc
7
+ : Array.isArray(loc) && loc.every((l) => typeof l === 'string')
8
+ ? loc
9
+ : undefined;
10
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
11
+ if (!opt || typeof opt !== 'object') {
12
+ return Intl.NumberFormat(locales).format(input);
13
+ }
14
+ const validateString = (value, allowedValues) => typeof value === 'string' && (allowedValues?.includes(value) ?? true)
15
+ ? value
16
+ : undefined;
17
+ const options = opt;
18
+ const style = validateString(options.style, ['decimal', 'currency', 'percent', 'unit']);
19
+ const currency = typeof options.currency === 'string' && options.currency.length === 3
20
+ ? options.currency
21
+ : undefined;
22
+ if (style === 'currency' && typeof currency !== 'string') {
23
+ // currency must be provided when style is currency
24
+ return null;
25
+ }
26
+ const currencyDisplay = validateString(options.currencyDisplay, ['code', 'symbol', 'narrowSymbol', 'name']);
27
+ const unit = typeof options.unit === 'string' ? options.unit : undefined;
28
+ if (style === 'unit' && typeof unit !== 'string') {
29
+ // unit must be provided when style is unit
30
+ return null;
31
+ }
32
+ const unitDisplay = validateString(options.unitDisplay, ['short', 'narrow', 'long']);
33
+ const minimumIntegerDigits = typeof options.minimumIntegerDigits === 'number' &&
34
+ options.minimumIntegerDigits >= 1 &&
35
+ options.minimumIntegerDigits <= 21
36
+ ? options.minimumIntegerDigits
37
+ : undefined;
38
+ const minimumFractionDigits = typeof options.minimumFractionDigits === 'number' &&
39
+ options.minimumFractionDigits >= 0 &&
40
+ options.minimumFractionDigits <= 100
41
+ ? options.minimumFractionDigits
42
+ : undefined;
43
+ const maximumFractionDigits = typeof options.maximumFractionDigits === 'number' &&
44
+ options.maximumFractionDigits >= 0 &&
45
+ options.maximumFractionDigits <= 100
46
+ ? options.maximumFractionDigits
47
+ : undefined;
48
+ const minimumSignificantDigits = typeof options.minimumSignificantDigits === 'number' &&
49
+ options.minimumSignificantDigits >= 1 &&
50
+ options.minimumSignificantDigits <= 21
51
+ ? options.minimumSignificantDigits
52
+ : undefined;
53
+ const maximumSignificantDigits = typeof options.maximumSignificantDigits === 'number' &&
54
+ options.maximumSignificantDigits >= 1 &&
55
+ options.maximumSignificantDigits <= 21
56
+ ? options.maximumSignificantDigits
57
+ : undefined;
58
+ const notation = validateString(options.notation, ['standard', 'scientific', 'engineering', 'compact']);
59
+ const compactDisplay = validateString(options.compactDisplay, ['short', 'long']);
60
+ // useGrouping can be a boolean, 'always', 'auto', or 'min2'
61
+ const validGroupingValues = ['always', 'auto', 'min2'];
62
+ const useGrouping = typeof options.useGrouping === 'boolean'
63
+ ? options.useGrouping
64
+ : validateString(options.useGrouping, validGroupingValues);
65
+ return new Intl.NumberFormat(locales, {
66
+ style,
67
+ currency,
68
+ currencyDisplay,
69
+ unit,
70
+ unitDisplay,
71
+ minimumIntegerDigits,
72
+ minimumFractionDigits,
73
+ maximumFractionDigits,
74
+ minimumSignificantDigits,
75
+ maximumSignificantDigits,
76
+ notation,
77
+ compactDisplay,
78
+ useGrouping,
79
+ }).format(input);
80
+ };
81
+ export default handler;
82
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/formatNumber/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA2B,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE;IAC5D,IAAI,OAAO,KAAK,KAAK,QAA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own>>;
3
+ export default handler;
@@ -0,0 +1,13 @@
1
+ const handler = ([list]) => {
2
+ if (Array.isArray(list)) {
3
+ const object = {};
4
+ for (const { key, value } of list) {
5
+ object[key] = value;
6
+ }
7
+ return object;
8
+ }
9
+ // throw new Error("Argument 'Array' must be of type array")
10
+ return null;
11
+ };
12
+ export default handler;
13
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/fromEntries/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA4C,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE;IAClE,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,MAAM,MAAM,GAAwB,EAAE,CAAA;QACtC,KAAK,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC;YAClC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACrB,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IACD,4DAA4D;IAC5D,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<unknown>;
3
+ export default handler;
@@ -0,0 +1,15 @@
1
+ const handler = ([collection, key]) => {
2
+ if (typeof collection === 'string') {
3
+ return collection[Number(key)];
4
+ }
5
+ const resolve = (collection, path) => {
6
+ if (path.length === 0) {
7
+ return collection;
8
+ }
9
+ const [head, ...rest] = path;
10
+ return resolve(collection?.[String(head)], rest);
11
+ };
12
+ return resolve(collection, Array.isArray(key) ? key : [key]);
13
+ };
14
+ export default handler;
15
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/get/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA4B,CAAC,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,EAAE;IAC7D,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QACnC,OAAO,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;IAChC,CAAC;IACD,MAAM,OAAO,GAAG,CAAC,UAAe,EAAE,IAAe,EAAW,EAAE;QAC5D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,UAAU,CAAA;QACnB,CAAC;QACD,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;QAC5B,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;IAClD,CAAC,CAAA;IACD,OAAO,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;AAC9D,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<string>;
3
+ export default handler;
@@ -0,0 +1,19 @@
1
+ const handler = ([name], { env, root }) => {
2
+ if (!name || typeof name !== 'string') {
3
+ return null;
4
+ }
5
+ if (!env.isServer) {
6
+ if (root instanceof ShadowRoot) {
7
+ return null;
8
+ }
9
+ return (root.cookie
10
+ .split('; ')
11
+ ?.find((row) => row.startsWith(`${name}=`))
12
+ ?.split('=')[1] ?? null);
13
+ }
14
+ else {
15
+ return env.request.cookies[name] ?? null;
16
+ }
17
+ };
18
+ export default handler;
19
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/getCookie/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA2B,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;IAChE,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAClB,IAAI,IAAI,YAAY,UAAU,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,CACL,IAAI,CAAC,MAAM;aACR,KAAK,CAAC,IAAI,CAAC;YACZ,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;YAC3C,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAC1B,CAAA;IACH,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAA;IAC1C,CAAC;AACH,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<HTMLElement>;
3
+ export default handler;
@@ -0,0 +1,9 @@
1
+ const handler = ([id], { root }) => {
2
+ if (typeof id !== 'string') {
3
+ // throw new Error("Argument 'Id' must be a string")
4
+ return null;
5
+ }
6
+ return root.getElementById(id);
7
+ };
8
+ export default handler;
9
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/getElementById/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAgC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;IAC9D,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;QAC3B,oDAAoD;QACpD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;AAChC,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<unknown>;
3
+ export default handler;
@@ -0,0 +1,21 @@
1
+ const handler = ([key]) => {
2
+ if (typeof key !== 'string' || key.length === 0) {
3
+ // throw new Error(`Invalid key: ${key}`)
4
+ return null;
5
+ }
6
+ if (typeof window === 'undefined') {
7
+ return null;
8
+ }
9
+ const value = window.localStorage.getItem(key);
10
+ if (value === null) {
11
+ return value;
12
+ }
13
+ try {
14
+ return JSON.parse(value);
15
+ }
16
+ catch {
17
+ return value;
18
+ }
19
+ };
20
+ export default handler;
21
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/getFromLocalStorage/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA4B,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE;IACjD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,yCAAyC;QACzC,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC9C,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,KAAK,CAAA;IACd,CAAC;IACD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<unknown>;
3
+ export default handler;
@@ -0,0 +1,21 @@
1
+ const handler = ([key]) => {
2
+ if (typeof key !== 'string' || key.length === 0) {
3
+ // throw new Error(`Invalid key: ${key}`)
4
+ return null;
5
+ }
6
+ if (typeof window === 'undefined') {
7
+ return null;
8
+ }
9
+ const value = window.sessionStorage.getItem(key);
10
+ if (value === null) {
11
+ return value;
12
+ }
13
+ try {
14
+ return JSON.parse(value);
15
+ }
16
+ catch {
17
+ return value;
18
+ }
19
+ };
20
+ export default handler;
21
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/getFromSessionStorage/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA4B,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE;IACjD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,yCAAyC;QACzC,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAChD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,KAAK,CAAA;IACd,CAAC;IACD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<string>;
3
+ export default handler;
@@ -0,0 +1,9 @@
1
+ import { STRING_TEMPLATE } from '@nordcraft/core/dist/api/template';
2
+ const handler = ([name]) => {
3
+ if (!name || typeof name !== 'string') {
4
+ return null;
5
+ }
6
+ return STRING_TEMPLATE('cookies', name);
7
+ };
8
+ export default handler;
9
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/getHttpOnlyCookie/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AAGnE,MAAM,OAAO,GAA2B,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE;IACjD,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;AACzC,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<boolean>;
3
+ export default handler;
@@ -0,0 +1,5 @@
1
+ const handler = ([first, second]) => {
2
+ return first >= second;
3
+ };
4
+ export default handler;
5
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/greaterOrEqueal/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA4B,CAAC,CAAC,KAAK,EAAE,MAAM,CAAQ,EAAE,EAAE;IAClE,OAAO,KAAK,IAAI,MAAM,CAAA;AACxB,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<boolean>;
3
+ export default handler;
@@ -0,0 +1,5 @@
1
+ const handler = ([first, second]) => {
2
+ return first > second;
3
+ };
4
+ export default handler;
5
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/greaterThan/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA4B,CAAC,CAAC,KAAK,EAAE,MAAM,CAAQ,EAAE,EAAE;IAClE,OAAO,KAAK,GAAG,MAAM,CAAA;AACvB,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ export declare const handler: FormulaHandler<Record<string, Array<unknown>>>;
3
+ export default handler;
4
+ export declare const getArgumentInputData: ([items]: unknown[], argIndex: number, input: any) => any;
@@ -0,0 +1,26 @@
1
+ export const handler = ([items, func,]) => {
2
+ if (typeof func !== 'function') {
3
+ // throw new Error("Argument 'Formula' must be of type formula")
4
+ return null;
5
+ }
6
+ if (!items || typeof items !== 'object' || !Array.isArray(items)) {
7
+ // throw new Error("Argument 'Array' must be of type array")
8
+ return null;
9
+ }
10
+ const res = {};
11
+ for (const index in items) {
12
+ const item = items[index];
13
+ const key = String(func({ item, index }));
14
+ res[key] = res[key] ?? [];
15
+ res[key].push(item);
16
+ }
17
+ return res;
18
+ };
19
+ export default handler;
20
+ export const getArgumentInputData = ([items], argIndex, input) => {
21
+ if (argIndex === 1 && Array.isArray(items)) {
22
+ return { ...input, Args: { item: items[0], index: 0 } };
23
+ }
24
+ return input;
25
+ };
26
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/groupBy/handler.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAmD,CAAC,CACtE,KAAK,EACL,IAAI,EACL,EAAE,EAAE;IACH,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,gEAAgE;QAChE,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjE,4DAA4D;QAC5D,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,GAAG,GAAwB,EAAE,CAAA;IAEnC,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAA;QACzB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;QACzC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;QACzB,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrB,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,eAAe,OAAO,CAAA;AAEtB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,CAAC,KAAK,CAAY,EAClB,QAAgB,EAChB,KAAU,EACV,EAAE;IACF,IAAI,QAAQ,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3C,OAAO,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAA;IACzD,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<boolean>;
3
+ export default handler;
@@ -0,0 +1,12 @@
1
+ const handler = ([collection, item]) => {
2
+ if (typeof collection === 'string' && typeof item === 'string') {
3
+ return collection.includes(item);
4
+ }
5
+ if (Array.isArray(collection)) {
6
+ return collection.some((collectionItem) => globalThis.toddle.isEqual(collectionItem, item));
7
+ }
8
+ // throw new Error("Argument 'Array' must be of type array or string")
9
+ return null;
10
+ };
11
+ export default handler;
12
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/includes/handler.ts"],"names":[],"mappings":"AACA,MAAM,OAAO,GAA4B,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;IAC9D,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC/D,OAAO,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAClC,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,EAAE,CACvC,UAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CACzD,CAAA;IACH,CAAC;IACD,sEAAsE;IACtE,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<number>;
3
+ export default handler;
@@ -0,0 +1,12 @@
1
+ const handler = ([collection, item]) => {
2
+ if (typeof collection === 'string') {
3
+ return collection.indexOf(item);
4
+ }
5
+ if (Array.isArray(collection)) {
6
+ return collection.findIndex((i) => globalThis.toddle.isEqual(i, item));
7
+ }
8
+ // throw new Error("Argument 'Array' must be of type array or string")
9
+ return null;
10
+ };
11
+ export default handler;
12
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/indexOf/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA2B,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;IAC7D,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QACnC,OAAO,UAAU,CAAC,OAAO,CAAC,IAAW,CAAC,CAAA;IACxC,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAC/B,UAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAC5C,CAAA;IACH,CAAC;IACD,sEAAsE;IACtE,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<boolean>;
3
+ export default handler;
@@ -0,0 +1,5 @@
1
+ const handler = (_, ctx) => {
2
+ return ctx.env.isServer;
3
+ };
4
+ export default handler;
5
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/isServer/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA4B,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;IAClD,OAAO,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAA;AACzB,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<string>;
3
+ export default handler;
@@ -0,0 +1,9 @@
1
+ const handler = ([list, separator]) => {
2
+ if (Array.isArray(list)) {
3
+ return list.join(String(separator));
4
+ }
5
+ // throw new Error("Argument 'Array' must be of type array")
6
+ return null;
7
+ };
8
+ export default handler;
9
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/join/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA2B,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE;IAC5D,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAA;IACrC,CAAC;IACD,4DAA4D;IAC5D,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<string>;
3
+ export default handler;
@@ -0,0 +1,6 @@
1
+ const handler = ([data, indentation]) => {
2
+ const indent = isNaN(Number(indentation)) ? 0 : Number(indentation);
3
+ return JSON.stringify(data, null, indent);
4
+ };
5
+ export default handler;
6
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/json/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA2B,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAAE;IAC9D,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IACnE,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;AAC3C,CAAC,CAAA;AACD,eAAe,OAAO,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ export declare const handler: FormulaHandler<Record<string, Array<unknown>>>;
3
+ export default handler;
4
+ export declare const getArgumentInputData: ([items]: unknown[], argIndex: number, input: any) => any;
@@ -0,0 +1,35 @@
1
+ export const handler = ([items, func,]) => {
2
+ if (typeof func !== 'function') {
3
+ // throw new Error("Argument 'Formula' must be of type formula")
4
+ return null;
5
+ }
6
+ if (!items || typeof items !== 'object') {
7
+ // throw new Error("Argument 'Array' must be of type array")
8
+ return null;
9
+ }
10
+ const list = Array.isArray(items) ? items : Object.entries(items);
11
+ const res = {};
12
+ for (let i = 0; i < list.length; i++) {
13
+ const item = list[i];
14
+ const key = String(func({ item, i }));
15
+ res[key] = item;
16
+ }
17
+ return res;
18
+ };
19
+ export default handler;
20
+ export const getArgumentInputData = ([items], argIndex, input) => {
21
+ if (argIndex === 0) {
22
+ return input;
23
+ }
24
+ if (Array.isArray(items)) {
25
+ return { ...input, Args: { item: items[0], index: 0 } };
26
+ }
27
+ if (items && typeof items === 'object') {
28
+ const [first] = Object.entries(items);
29
+ if (first) {
30
+ return { ...input, Args: { value: first[1], key: first[0] } };
31
+ }
32
+ }
33
+ return input;
34
+ };
35
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/keyBy/handler.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAmD,CAAC,CACtE,KAAK,EACL,IAAI,EACL,EAAE,EAAE;IACH,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,gEAAgE;QAChE,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,4DAA4D;QAC5D,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAEjE,MAAM,GAAG,GAAwB,EAAE,CAAA;IACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;QACrC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;IACjB,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,eAAe,OAAO,CAAA;AAEtB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,CAAC,KAAK,CAAY,EAClB,QAAgB,EAChB,KAAU,EACV,EAAE;IACF,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;QACnB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAA;IACzD,CAAC;IACD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACrC,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;QAC/D,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<readonly string[]>;
3
+ export default handler;
@@ -0,0 +1,12 @@
1
+ const handler = (_, { env }) => {
2
+ if (!env.isServer) {
3
+ return window.navigator.languages;
4
+ }
5
+ else {
6
+ return (env.request?.headers['accept-language']
7
+ ?.split(',')
8
+ .map((lang) => lang.split(';')[0]) ?? []);
9
+ }
10
+ };
11
+ export default handler;
12
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/languages/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAsC,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;IAChE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAClB,OAAO,MAAM,CAAC,SAAS,CAAC,SAAS,CAAA;IACnC,CAAC;SAAM,CAAC;QACN,OAAO,CACL,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC;YACrC,EAAE,KAAK,CAAC,GAAG,CAAC;aACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAC3C,CAAA;IACH,CAAC;AACH,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<unknown>;
3
+ export default handler;
@@ -0,0 +1,9 @@
1
+ const handler = ([list]) => {
2
+ if (typeof list === 'string' || Array.isArray(list)) {
3
+ return list[list.length - 1];
4
+ }
5
+ // throw new Error("Argument 'Array' must be of type array")
6
+ return null;
7
+ };
8
+ export default handler;
9
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../formulas/last/handler.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAA4B,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE;IAClD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAC9B,CAAC;IACD,4DAA4D;IAC5D,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FormulaHandler } from '@nordcraft/core/dist/types';
2
+ declare const handler: FormulaHandler<number>;
3
+ export default handler;