@aglyn/shared-util-tools 1.0.0-beta.143

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 (288) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +7 -0
  3. package/package.json +39 -0
  4. package/src/index.d.ts +72 -0
  5. package/src/index.js +87 -0
  6. package/src/index.js.map +1 -0
  7. package/src/lib/apply-mixins.d.ts +24 -0
  8. package/src/lib/apply-mixins.js +31 -0
  9. package/src/lib/apply-mixins.js.map +1 -0
  10. package/src/lib/array/array-copy-deep.d.ts +6 -0
  11. package/src/lib/array/array-copy-deep.js +25 -0
  12. package/src/lib/array/array-copy-deep.js.map +1 -0
  13. package/src/lib/array/array-copy-shallow.d.ts +19 -0
  14. package/src/lib/array/array-copy-shallow.js +20 -0
  15. package/src/lib/array/array-copy-shallow.js.map +1 -0
  16. package/src/lib/array/array-from-length.d.ts +18 -0
  17. package/src/lib/array/array-from-length.js +23 -0
  18. package/src/lib/array/array-from-length.js.map +1 -0
  19. package/src/lib/array/array-from.d.ts +24 -0
  20. package/src/lib/array/array-from.js +26 -0
  21. package/src/lib/array/array-from.js.map +1 -0
  22. package/src/lib/array/array-move-at-index.d.ts +24 -0
  23. package/src/lib/array/array-move-at-index.js +32 -0
  24. package/src/lib/array/array-move-at-index.js.map +1 -0
  25. package/src/lib/array/array-of-entries-to-object.d.ts +23 -0
  26. package/src/lib/array/array-of-entries-to-object.js +26 -0
  27. package/src/lib/array/array-of-entries-to-object.js.map +1 -0
  28. package/src/lib/array/array-overrides.d.ts +29 -0
  29. package/src/lib/array/array-overrides.js +71 -0
  30. package/src/lib/array/array-overrides.js.map +1 -0
  31. package/src/lib/array/array-push-at-index.d.ts +28 -0
  32. package/src/lib/array/array-push-at-index.js +32 -0
  33. package/src/lib/array/array-push-at-index.js.map +1 -0
  34. package/src/lib/array/array-remove-at-index.d.ts +23 -0
  35. package/src/lib/array/array-remove-at-index.js +26 -0
  36. package/src/lib/array/array-remove-at-index.js.map +1 -0
  37. package/src/lib/array/array-remove-item.d.ts +23 -0
  38. package/src/lib/array/array-remove-item.js +27 -0
  39. package/src/lib/array/array-remove-item.js.map +1 -0
  40. package/src/lib/array/array-safe.d.ts +21 -0
  41. package/src/lib/array/array-safe.js +29 -0
  42. package/src/lib/array/array-safe.js.map +1 -0
  43. package/src/lib/array/array-sort-by-deep-property.d.ts +26 -0
  44. package/src/lib/array/array-sort-by-deep-property.js +39 -0
  45. package/src/lib/array/array-sort-by-deep-property.js.map +1 -0
  46. package/src/lib/array/array-sort-by.d.ts +26 -0
  47. package/src/lib/array/array-sort-by.js +36 -0
  48. package/src/lib/array/array-sort-by.js.map +1 -0
  49. package/src/lib/array/array-update-at-index.d.ts +18 -0
  50. package/src/lib/array/array-update-at-index.js +22 -0
  51. package/src/lib/array/array-update-at-index.js.map +1 -0
  52. package/src/lib/array/array-update.d.ts +23 -0
  53. package/src/lib/array/array-update.js +25 -0
  54. package/src/lib/array/array-update.js.map +1 -0
  55. package/src/lib/bitwise/bitwise-has-all-attributes.d.ts +18 -0
  56. package/src/lib/bitwise/bitwise-has-all-attributes.js +21 -0
  57. package/src/lib/bitwise/bitwise-has-all-attributes.js.map +1 -0
  58. package/src/lib/bitwise/bitwise-has-attribute.d.ts +18 -0
  59. package/src/lib/bitwise/bitwise-has-attribute.js +21 -0
  60. package/src/lib/bitwise/bitwise-has-attribute.js.map +1 -0
  61. package/src/lib/bitwise/bitwise-has-only-attributes.d.ts +18 -0
  62. package/src/lib/bitwise/bitwise-has-only-attributes.js +21 -0
  63. package/src/lib/bitwise/bitwise-has-only-attributes.js.map +1 -0
  64. package/src/lib/contrast.d.ts +65 -0
  65. package/src/lib/contrast.js +78 -0
  66. package/src/lib/contrast.js.map +1 -0
  67. package/src/lib/copy-shallow.d.ts +19 -0
  68. package/src/lib/copy-shallow.js +20 -0
  69. package/src/lib/copy-shallow.js.map +1 -0
  70. package/src/lib/copy.d.ts +19 -0
  71. package/src/lib/copy.js +20 -0
  72. package/src/lib/copy.js.map +1 -0
  73. package/src/lib/create-chained-function.d.ts +38 -0
  74. package/src/lib/create-chained-function.js +46 -0
  75. package/src/lib/create-chained-function.js.map +1 -0
  76. package/src/lib/crud.d.ts +46 -0
  77. package/src/lib/crud.js +55 -0
  78. package/src/lib/crud.js.map +1 -0
  79. package/src/lib/css.d.ts +41 -0
  80. package/src/lib/css.js +54 -0
  81. package/src/lib/css.js.map +1 -0
  82. package/src/lib/escape-html.d.ts +38 -0
  83. package/src/lib/escape-html.js +47 -0
  84. package/src/lib/escape-html.js.map +1 -0
  85. package/src/lib/falsy.d.ts +23 -0
  86. package/src/lib/falsy.js +25 -0
  87. package/src/lib/falsy.js.map +1 -0
  88. package/src/lib/get-display-name.d.ts +46 -0
  89. package/src/lib/get-display-name.js +64 -0
  90. package/src/lib/get-display-name.js.map +1 -0
  91. package/src/lib/get-property.d.ts +30 -0
  92. package/src/lib/get-property.js +36 -0
  93. package/src/lib/get-property.js.map +1 -0
  94. package/src/lib/get-static-field.d.ts +23 -0
  95. package/src/lib/get-static-field.js +25 -0
  96. package/src/lib/get-static-field.js.map +1 -0
  97. package/src/lib/guards/index.d.ts +46 -0
  98. package/src/lib/guards/index.js +47 -0
  99. package/src/lib/guards/index.js.map +1 -0
  100. package/src/lib/guards/lib/_has-own-property.d.ts +24 -0
  101. package/src/lib/guards/lib/_has-own-property.js +27 -0
  102. package/src/lib/guards/lib/_has-own-property.js.map +1 -0
  103. package/src/lib/guards/lib/_is-arr-empty.d.ts +23 -0
  104. package/src/lib/guards/lib/_is-arr-empty.js +25 -0
  105. package/src/lib/guards/lib/_is-arr-empty.js.map +1 -0
  106. package/src/lib/guards/lib/_is-arr-of-arr.d.ts +25 -0
  107. package/src/lib/guards/lib/_is-arr-of-arr.js +31 -0
  108. package/src/lib/guards/lib/_is-arr-of-arr.js.map +1 -0
  109. package/src/lib/guards/lib/_is-arr.d.ts +21 -0
  110. package/src/lib/guards/lib/_is-arr.js +23 -0
  111. package/src/lib/guards/lib/_is-arr.js.map +1 -0
  112. package/src/lib/guards/lib/_is-big.d.ts +25 -0
  113. package/src/lib/guards/lib/_is-big.js +27 -0
  114. package/src/lib/guards/lib/_is-big.js.map +1 -0
  115. package/src/lib/guards/lib/_is-bool.d.ts +25 -0
  116. package/src/lib/guards/lib/_is-bool.js +27 -0
  117. package/src/lib/guards/lib/_is-bool.js.map +1 -0
  118. package/src/lib/guards/lib/_is-buff.d.ts +25 -0
  119. package/src/lib/guards/lib/_is-buff.js +29 -0
  120. package/src/lib/guards/lib/_is-buff.js.map +1 -0
  121. package/src/lib/guards/lib/_is-ctor.d.ts +25 -0
  122. package/src/lib/guards/lib/_is-ctor.js +30 -0
  123. package/src/lib/guards/lib/_is-ctor.js.map +1 -0
  124. package/src/lib/guards/lib/_is-empty-str-or-arr.d.ts +25 -0
  125. package/src/lib/guards/lib/_is-empty-str-or-arr.js +29 -0
  126. package/src/lib/guards/lib/_is-empty-str-or-arr.js.map +1 -0
  127. package/src/lib/guards/lib/_is-equality-same-type.d.ts +25 -0
  128. package/src/lib/guards/lib/_is-equality-same-type.js +33 -0
  129. package/src/lib/guards/lib/_is-equality-same-type.js.map +1 -0
  130. package/src/lib/guards/lib/_is-fn-t.d.ts +25 -0
  131. package/src/lib/guards/lib/_is-fn-t.js +27 -0
  132. package/src/lib/guards/lib/_is-fn-t.js.map +1 -0
  133. package/src/lib/guards/lib/_is-length-of.d.ts +47 -0
  134. package/src/lib/guards/lib/_is-length-of.js +49 -0
  135. package/src/lib/guards/lib/_is-length-of.js.map +1 -0
  136. package/src/lib/guards/lib/_is-length.d.ts +25 -0
  137. package/src/lib/guards/lib/_is-length.js +34 -0
  138. package/src/lib/guards/lib/_is-length.js.map +1 -0
  139. package/src/lib/guards/lib/_is-null.d.ts +25 -0
  140. package/src/lib/guards/lib/_is-null.js +27 -0
  141. package/src/lib/guards/lib/_is-null.js.map +1 -0
  142. package/src/lib/guards/lib/_is-num-neg.d.ts +25 -0
  143. package/src/lib/guards/lib/_is-num-neg.js +28 -0
  144. package/src/lib/guards/lib/_is-num-neg.js.map +1 -0
  145. package/src/lib/guards/lib/_is-num-pos.d.ts +25 -0
  146. package/src/lib/guards/lib/_is-num-pos.js +28 -0
  147. package/src/lib/guards/lib/_is-num-pos.js.map +1 -0
  148. package/src/lib/guards/lib/_is-num-t.d.ts +25 -0
  149. package/src/lib/guards/lib/_is-num-t.js +27 -0
  150. package/src/lib/guards/lib/_is-num-t.js.map +1 -0
  151. package/src/lib/guards/lib/_is-num-zero.d.ts +25 -0
  152. package/src/lib/guards/lib/_is-num-zero.js +28 -0
  153. package/src/lib/guards/lib/_is-num-zero.js.map +1 -0
  154. package/src/lib/guards/lib/_is-num.d.ts +26 -0
  155. package/src/lib/guards/lib/_is-num.js +29 -0
  156. package/src/lib/guards/lib/_is-num.js.map +1 -0
  157. package/src/lib/guards/lib/_is-obj-t.d.ts +26 -0
  158. package/src/lib/guards/lib/_is-obj-t.js +28 -0
  159. package/src/lib/guards/lib/_is-obj-t.js.map +1 -0
  160. package/src/lib/guards/lib/_is-obj.d.ts +27 -0
  161. package/src/lib/guards/lib/_is-obj.js +32 -0
  162. package/src/lib/guards/lib/_is-obj.js.map +1 -0
  163. package/src/lib/guards/lib/_is-prim.d.ts +27 -0
  164. package/src/lib/guards/lib/_is-prim.js +35 -0
  165. package/src/lib/guards/lib/_is-prim.js.map +1 -0
  166. package/src/lib/guards/lib/_is-promise-like.d.ts +24 -0
  167. package/src/lib/guards/lib/_is-promise-like.js +28 -0
  168. package/src/lib/guards/lib/_is-promise-like.js.map +1 -0
  169. package/src/lib/guards/lib/_is-str-empty.d.ts +25 -0
  170. package/src/lib/guards/lib/_is-str-empty.js +28 -0
  171. package/src/lib/guards/lib/_is-str-empty.js.map +1 -0
  172. package/src/lib/guards/lib/_is-str-t.d.ts +26 -0
  173. package/src/lib/guards/lib/_is-str-t.js +28 -0
  174. package/src/lib/guards/lib/_is-str-t.js.map +1 -0
  175. package/src/lib/guards/lib/_is-sym-t.d.ts +25 -0
  176. package/src/lib/guards/lib/_is-sym-t.js +27 -0
  177. package/src/lib/guards/lib/_is-sym-t.js.map +1 -0
  178. package/src/lib/guards/lib/_is-und-or-null.d.ts +25 -0
  179. package/src/lib/guards/lib/_is-und-or-null.js +29 -0
  180. package/src/lib/guards/lib/_is-und-or-null.js.map +1 -0
  181. package/src/lib/guards/lib/_is-und-t.d.ts +25 -0
  182. package/src/lib/guards/lib/_is-und-t.js +27 -0
  183. package/src/lib/guards/lib/_is-und-t.js.map +1 -0
  184. package/src/lib/interop-default.d.ts +18 -0
  185. package/src/lib/interop-default.js +21 -0
  186. package/src/lib/interop-default.js.map +1 -0
  187. package/src/lib/length.d.ts +22 -0
  188. package/src/lib/length.js +28 -0
  189. package/src/lib/length.js.map +1 -0
  190. package/src/lib/linear-regex.d.ts +136 -0
  191. package/src/lib/linear-regex.js +1140 -0
  192. package/src/lib/linear-regex.js.map +1 -0
  193. package/src/lib/no-side-effects.d.ts +29 -0
  194. package/src/lib/no-side-effects.js +33 -0
  195. package/src/lib/no-side-effects.js.map +1 -0
  196. package/src/lib/noop.d.ts +21 -0
  197. package/src/lib/noop.js +22 -0
  198. package/src/lib/noop.js.map +1 -0
  199. package/src/lib/normalized.d.ts +164 -0
  200. package/src/lib/normalized.js +232 -0
  201. package/src/lib/normalized.js.map +1 -0
  202. package/src/lib/number/number-from-hexadecimal.d.ts +24 -0
  203. package/src/lib/number/number-from-hexadecimal.js +29 -0
  204. package/src/lib/number/number-from-hexadecimal.js.map +1 -0
  205. package/src/lib/number/number-to-hexadecimal.d.ts +22 -0
  206. package/src/lib/number/number-to-hexadecimal.js +24 -0
  207. package/src/lib/number/number-to-hexadecimal.js.map +1 -0
  208. package/src/lib/number/to-num.d.ts +41 -0
  209. package/src/lib/number/to-num.js +41 -0
  210. package/src/lib/number/to-num.js.map +1 -0
  211. package/src/lib/numeronym.d.ts +41 -0
  212. package/src/lib/numeronym.js +54 -0
  213. package/src/lib/numeronym.js.map +1 -0
  214. package/src/lib/object/object-clone-deep.d.ts +21 -0
  215. package/src/lib/object/object-clone-deep.js +24 -0
  216. package/src/lib/object/object-clone-deep.js.map +1 -0
  217. package/src/lib/object/object-clone.d.ts +21 -0
  218. package/src/lib/object/object-clone.js +24 -0
  219. package/src/lib/object/object-clone.js.map +1 -0
  220. package/src/lib/object/object-delete-property.d.ts +28 -0
  221. package/src/lib/object/object-delete-property.js +32 -0
  222. package/src/lib/object/object-delete-property.js.map +1 -0
  223. package/src/lib/object/object-get-deep-property.d.ts +35 -0
  224. package/src/lib/object/object-get-deep-property.js +40 -0
  225. package/src/lib/object/object-get-deep-property.js.map +1 -0
  226. package/src/lib/object/object-get-keys-and-symbol-properties.d.ts +23 -0
  227. package/src/lib/object/object-get-keys-and-symbol-properties.js +30 -0
  228. package/src/lib/object/object-get-keys-and-symbol-properties.js.map +1 -0
  229. package/src/lib/object/object-remap.d.ts +33 -0
  230. package/src/lib/object/object-remap.js +36 -0
  231. package/src/lib/object/object-remap.js.map +1 -0
  232. package/src/lib/object/object-safe.d.ts +27 -0
  233. package/src/lib/object/object-safe.js +30 -0
  234. package/src/lib/object/object-safe.js.map +1 -0
  235. package/src/lib/object/object-set-deep-property.d.ts +35 -0
  236. package/src/lib/object/object-set-deep-property.js +44 -0
  237. package/src/lib/object/object-set-deep-property.js.map +1 -0
  238. package/src/lib/object/object-update.d.ts +28 -0
  239. package/src/lib/object/object-update.js +32 -0
  240. package/src/lib/object/object-update.js.map +1 -0
  241. package/src/lib/operator/compare.d.ts +26 -0
  242. package/src/lib/operator/compare.js +42 -0
  243. package/src/lib/operator/compare.js.map +1 -0
  244. package/src/lib/operator/definitions.d.ts +184 -0
  245. package/src/lib/operator/definitions.js +110 -0
  246. package/src/lib/operator/definitions.js.map +1 -0
  247. package/src/lib/operator/index.d.ts +19 -0
  248. package/src/lib/operator/index.js +20 -0
  249. package/src/lib/operator/index.js.map +1 -0
  250. package/src/lib/operator/inference.d.ts +66 -0
  251. package/src/lib/operator/inference.js +60 -0
  252. package/src/lib/operator/inference.js.map +1 -0
  253. package/src/lib/secret-box.d.ts +152 -0
  254. package/src/lib/secret-box.js +263 -0
  255. package/src/lib/secret-box.js.map +1 -0
  256. package/src/lib/serialize/base64-isomorphic-decode.d.ts +23 -0
  257. package/src/lib/serialize/base64-isomorphic-decode.js +28 -0
  258. package/src/lib/serialize/base64-isomorphic-decode.js.map +1 -0
  259. package/src/lib/serialize/base64-isomorphic-encode.d.ts +23 -0
  260. package/src/lib/serialize/base64-isomorphic-encode.js +28 -0
  261. package/src/lib/serialize/base64-isomorphic-encode.js.map +1 -0
  262. package/src/lib/serialize/json-deserialize.d.ts +25 -0
  263. package/src/lib/serialize/json-deserialize.js +27 -0
  264. package/src/lib/serialize/json-deserialize.js.map +1 -0
  265. package/src/lib/serialize/json-serialize.d.ts +25 -0
  266. package/src/lib/serialize/json-serialize.js +27 -0
  267. package/src/lib/serialize/json-serialize.js.map +1 -0
  268. package/src/lib/serialize/php-serial-deserialize-from-byte-stream.d.ts +77 -0
  269. package/src/lib/serialize/php-serial-deserialize-from-byte-stream.js +77 -0
  270. package/src/lib/serialize/php-serial-deserialize-from-byte-stream.js.map +1 -0
  271. package/src/lib/serialize/php-serial-is-serialized-byte-stream.d.ts +77 -0
  272. package/src/lib/serialize/php-serial-is-serialized-byte-stream.js +77 -0
  273. package/src/lib/serialize/php-serial-is-serialized-byte-stream.js.map +1 -0
  274. package/src/lib/serialize/php-serial-serialize-to-byte-stream.d.ts +77 -0
  275. package/src/lib/serialize/php-serial-serialize-to-byte-stream.js +77 -0
  276. package/src/lib/serialize/php-serial-serialize-to-byte-stream.js.map +1 -0
  277. package/src/lib/split-display-name.d.ts +36 -0
  278. package/src/lib/split-display-name.js +47 -0
  279. package/src/lib/split-display-name.js.map +1 -0
  280. package/src/lib/str.d.ts +21 -0
  281. package/src/lib/str.js +23 -0
  282. package/src/lib/str.js.map +1 -0
  283. package/src/lib/trim.d.ts +25 -0
  284. package/src/lib/trim.js +28 -0
  285. package/src/lib/trim.js.map +1 -0
  286. package/src/lib/truthy.d.ts +23 -0
  287. package/src/lib/truthy.js +30 -0
  288. package/src/lib/truthy.js.map +1 -0
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ /**
17
+ * Shallow copy iterable or array like
18
+ * @param iterable - An iterable object to convert to an array.
19
+ * @param callbackFn - A mapping function to call on every element of the array.
20
+ * @param thisArg - Value of 'this' used to invoke the callbackFn
21
+ */ export function arrayFrom(iterable, callbackFn, thisArg) {
22
+ return Array.from(iterable, callbackFn, thisArg);
23
+ }
24
+ export default arrayFrom;
25
+
26
+ //# sourceMappingURL=array-from.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/array/array-from.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Shallow copy iterable or array like\n * @param iterable - An iterable object to convert to an array.\n * @param callbackFn - A mapping function to call on every element of the array.\n * @param thisArg - Value of 'this' used to invoke the callbackFn\n */\nexport function arrayFrom<T, U>(\n iterable: Iterable<T> | ArrayLike<T>,\n callbackFn: (v: T, k: number) => U,\n thisArg?: any,\n): U[] {\n return Array.from(iterable, callbackFn, thisArg)\n}\nexport default arrayFrom\n"],"names":["arrayFrom","iterable","callbackFn","thisArg","Array","from"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;CAKC,GACD,OAAO,SAASA,UACdC,QAAoC,EACpCC,UAAkC,EAClCC,OAAa;IAEb,OAAOC,MAAMC,IAAI,CAACJ,UAAUC,YAAYC;AAC1C;AACA,eAAeH,UAAS"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Move an element in the array
19
+ * @param array - The array to mutate and reorder
20
+ * @param index - Current index of the item to move
21
+ * @param newIndex - New index for the item to be moved to
22
+ */
23
+ export declare function arrayMoveAtIndex<K extends number & keyof T, T extends Array<U>, U>(array: T, index: K | any, newIndex: K | any): T;
24
+ export default arrayMoveAtIndex;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ /**
17
+ * Move an element in the array
18
+ * @param array - The array to mutate and reorder
19
+ * @param index - Current index of the item to move
20
+ * @param newIndex - New index for the item to be moved to
21
+ */ export function arrayMoveAtIndex(array, index, newIndex) {
22
+ if (!Array.isArray(array)) {
23
+ throw new TypeError(`arrayMoveAtIndex: expected an array but received ${array === null ? 'null' : typeof array}`);
24
+ }
25
+ const item = array.splice(index, 1)[0];
26
+ if (isNaN(newIndex)) array.push(item);
27
+ else array.splice(newIndex, 0, item);
28
+ return array;
29
+ }
30
+ export default arrayMoveAtIndex;
31
+
32
+ //# sourceMappingURL=array-move-at-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/array/array-move-at-index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n/**\n * Move an element in the array\n * @param array - The array to mutate and reorder\n * @param index - Current index of the item to move\n * @param newIndex - New index for the item to be moved to\n */\nexport function arrayMoveAtIndex<K extends number & keyof T, T extends Array<U>, U>(\n array: T,\n index: K | any,\n newIndex: K | any,\n): T {\n if (!Array.isArray(array)) {\n throw new TypeError(\n `arrayMoveAtIndex: expected an array but received ${array === null ? 'null' : typeof array}`,\n )\n }\n const item = array.splice(index, 1)[0]\n if (isNaN(newIndex)) array.push(item)\n else array.splice(newIndex, 0, item)\n return array\n}\nexport default arrayMoveAtIndex\n"],"names":["arrayMoveAtIndex","array","index","newIndex","Array","isArray","TypeError","item","splice","isNaN","push"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD;;;;;CAKC,GACD,OAAO,SAASA,iBACdC,KAAQ,EACRC,KAAc,EACdC,QAAiB;IAEjB,IAAI,CAACC,MAAMC,OAAO,CAACJ,QAAQ;QACzB,MAAM,IAAIK,UACR,CAAC,iDAAiD,EAAEL,UAAU,OAAO,SAAS,OAAOA,OAAO;IAEhG;IACA,MAAMM,OAAON,MAAMO,MAAM,CAACN,OAAO,EAAE,CAAC,EAAE;IACtC,IAAIO,MAAMN,WAAWF,MAAMS,IAAI,CAACH;SAC3BN,MAAMO,MAAM,CAACL,UAAU,GAAGI;IAC/B,OAAON;AACT;AACA,eAAeD,iBAAgB"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export type ArrayEntriesIndex<K extends keyof any, V> = [key: K, value: V];
18
+ /**
19
+ * Create KeyValueMap from an array of tuple with key and value
20
+ * @param entries - Array of tuples 0:key, 1:val to map into a new object
21
+ */
22
+ export declare function arrayOfEntriesToObject<K extends keyof any, V>(entries: ArrayEntriesIndex<K, V>[]): Record<K, V>;
23
+ export default arrayOfEntriesToObject;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ /**
17
+ * Create KeyValueMap from an array of tuple with key and value
18
+ * @param entries - Array of tuples 0:key, 1:val to map into a new object
19
+ */ export function arrayOfEntriesToObject(entries) {
20
+ return Object.assign({}, ...entries.map(([key, val])=>({
21
+ [key]: val
22
+ })));
23
+ }
24
+ export default arrayOfEntriesToObject;
25
+
26
+ //# sourceMappingURL=array-of-entries-to-object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/array/array-of-entries-to-object.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nexport type ArrayEntriesIndex<K extends keyof any, V> = [key: K, value: V]\n\n/**\n * Create KeyValueMap from an array of tuple with key and value\n * @param entries - Array of tuples 0:key, 1:val to map into a new object\n */\nexport function arrayOfEntriesToObject<K extends keyof any, V>(\n entries: ArrayEntriesIndex<K, V>[],\n): Record<K, V> {\n return Object.assign({}, ...entries.map(([key, val]) => ({[key]: val})))\n}\nexport default arrayOfEntriesToObject\n"],"names":["arrayOfEntriesToObject","entries","Object","assign","map","key","val"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAKD;;;CAGC,GACD,OAAO,SAASA,uBACdC,OAAkC;IAElC,OAAOC,OAAOC,MAAM,CAAC,CAAC,MAAMF,QAAQG,GAAG,CAAC,CAAC,CAACC,KAAKC,IAAI,GAAM,CAAA;YAAC,CAACD,IAAI,EAAEC;QAAG,CAAA;AACtE;AACA,eAAeN,uBAAsB"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ declare global {
18
+ interface Array<T> {
19
+ $_cloneShallow(): Array<T>;
20
+ $_cloneDeep(): Array<T>;
21
+ $_moveAtIndex(index: number, newIndex: number): Array<T>;
22
+ $_pushAtIndex(index: number, newIndex: number): Array<T>;
23
+ $_removeItem(elem: T): Array<T>;
24
+ $_removeAtIndex(index: number): Array<T>;
25
+ $_replaceAtIndex(index: number, elem: T): Array<T>;
26
+ $_truthy(): Array<T>;
27
+ }
28
+ }
29
+ export {};
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import arrayCopyDeep from "./array-copy-deep.js";
17
+ import arrayCopyShallow from "./array-copy-shallow.js";
18
+ import arrayMoveAtIndex from "./array-move-at-index.js";
19
+ import arrayPushAtIndex from "./array-push-at-index.js";
20
+ import arrayRemoveAtIndex from "./array-remove-at-index.js";
21
+ import arrayRemoveItem from "./array-remove-item.js";
22
+ import arrayUpdateAtIndex from "./array-update-at-index.js";
23
+ /**
24
+ * Define all custom Array prototype methods with `enumerable: false`.
25
+ *
26
+ * WHY: Simple property assignment (`Array.prototype.foo = fn`) creates an ENUMERABLE property.
27
+ * MUI's `styleFunctionSx` iterates sx array objects with `for...in`, which walks the entire
28
+ * prototype chain and picks up any enumerable inherited properties — including our custom methods.
29
+ * It then calls them via `callIfFn(fn, theme)` WITHOUT a receiver, making `this === undefined`
30
+ * (strict-mode ES modules), which caused "arrayMoveAtIndex: expected an array but received undefined".
31
+ *
32
+ * Using `Object.defineProperty` with `enumerable: false` makes the methods invisible to
33
+ * `for...in`, `Object.keys`, and `JSON.stringify` while still accessible via direct calls
34
+ * and prototype chain lookups.
35
+ *
36
+ * ALSO: No guard (`if (!Array.prototype.$_xxx)`) so that Turbopack HMR re-evaluations always
37
+ * re-register the methods with fresh module bindings.
38
+ */ function defineArrayMethod(name, fn) {
39
+ Object.defineProperty(Array.prototype, name, {
40
+ value: fn,
41
+ enumerable: false,
42
+ writable: true,
43
+ configurable: true
44
+ });
45
+ }
46
+ defineArrayMethod('$_cloneShallow', function() {
47
+ return arrayCopyShallow(this);
48
+ });
49
+ defineArrayMethod('$_cloneDeep', function() {
50
+ return arrayCopyDeep(this);
51
+ });
52
+ defineArrayMethod('$_moveAtIndex', function(index, newIndex) {
53
+ return arrayMoveAtIndex(this, index, newIndex);
54
+ });
55
+ defineArrayMethod('$_pushAtIndex', function(index, ...elems) {
56
+ return arrayPushAtIndex(this, index, ...elems);
57
+ });
58
+ defineArrayMethod('$_removeItem', function(elem) {
59
+ return arrayRemoveItem(this, elem);
60
+ });
61
+ defineArrayMethod('$_removeAtIndex', function(index) {
62
+ return arrayRemoveAtIndex(this, index);
63
+ });
64
+ defineArrayMethod('$_replaceAtIndex', function(index, elem) {
65
+ return arrayUpdateAtIndex(this, index, elem);
66
+ });
67
+ defineArrayMethod('$_truthy', function() {
68
+ return this.filter(Boolean);
69
+ });
70
+
71
+ //# sourceMappingURL=array-overrides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/array/array-overrides.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport arrayCopyDeep from './array-copy-deep'\nimport arrayCopyShallow from './array-copy-shallow'\nimport arrayMoveAtIndex from './array-move-at-index'\nimport arrayPushAtIndex from './array-push-at-index'\nimport arrayRemoveAtIndex from './array-remove-at-index'\nimport arrayRemoveItem from './array-remove-item'\nimport arrayUpdateAtIndex from './array-update-at-index'\n\ndeclare global {\n interface Array<T> {\n $_cloneShallow(): Array<T>\n $_cloneDeep(): Array<T>\n $_moveAtIndex(index: number, newIndex: number): Array<T>\n $_pushAtIndex(index: number, newIndex: number): Array<T>\n $_removeItem(elem: T): Array<T>\n $_removeAtIndex(index: number): Array<T>\n $_replaceAtIndex(index: number, elem: T): Array<T>\n $_truthy(): Array<T>\n }\n}\n\nexport {}\n\n/**\n * Define all custom Array prototype methods with `enumerable: false`.\n *\n * WHY: Simple property assignment (`Array.prototype.foo = fn`) creates an ENUMERABLE property.\n * MUI's `styleFunctionSx` iterates sx array objects with `for...in`, which walks the entire\n * prototype chain and picks up any enumerable inherited properties — including our custom methods.\n * It then calls them via `callIfFn(fn, theme)` WITHOUT a receiver, making `this === undefined`\n * (strict-mode ES modules), which caused \"arrayMoveAtIndex: expected an array but received undefined\".\n *\n * Using `Object.defineProperty` with `enumerable: false` makes the methods invisible to\n * `for...in`, `Object.keys`, and `JSON.stringify` while still accessible via direct calls\n * and prototype chain lookups.\n *\n * ALSO: No guard (`if (!Array.prototype.$_xxx)`) so that Turbopack HMR re-evaluations always\n * re-register the methods with fresh module bindings.\n */\nfunction defineArrayMethod(name: string, fn: (...args: any[]) => any): void {\n Object.defineProperty(Array.prototype, name, {\n value: fn,\n enumerable: false, // ← invisible to for...in (fixes the MUI sx iteration bug)\n writable: true,\n configurable: true, // ← allows HMR re-evaluation to overwrite\n })\n}\n\ndefineArrayMethod('$_cloneShallow', function <T>(this: Array<T>): Array<T> {\n return arrayCopyShallow(this)\n})\n\ndefineArrayMethod('$_cloneDeep', function <T>(this: Array<T>): Array<T> {\n return arrayCopyDeep(this)\n})\n\ndefineArrayMethod('$_moveAtIndex', function <T>(\n this: Array<T>,\n index: number,\n newIndex: number,\n): Array<T> {\n return arrayMoveAtIndex(this, index, newIndex)\n})\n\ndefineArrayMethod('$_pushAtIndex', function <T>(\n this: Array<T>,\n index: number,\n ...elems: Array<T>\n): Array<T> {\n return arrayPushAtIndex(this, index, ...elems)\n})\n\ndefineArrayMethod('$_removeItem', function <T>(this: Array<T>, elem: T): Array<T> {\n return arrayRemoveItem(this, elem)\n})\n\ndefineArrayMethod('$_removeAtIndex', function <T>(this: Array<T>, index: number): Array<T> {\n return arrayRemoveAtIndex(this, index)\n})\n\ndefineArrayMethod('$_replaceAtIndex', function <T>(\n this: Array<T>,\n index: number,\n elem: T,\n): Array<T> {\n return arrayUpdateAtIndex(this, index, elem)\n})\n\ndefineArrayMethod('$_truthy', function <T>(this: Array<T>): Array<T> {\n return this.filter(Boolean)\n})\n"],"names":["arrayCopyDeep","arrayCopyShallow","arrayMoveAtIndex","arrayPushAtIndex","arrayRemoveAtIndex","arrayRemoveItem","arrayUpdateAtIndex","defineArrayMethod","name","fn","Object","defineProperty","Array","prototype","value","enumerable","writable","configurable","index","newIndex","elems","elem","filter","Boolean"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,OAAOA,mBAAmB,uBAAmB;AAC7C,OAAOC,sBAAsB,0BAAsB;AACnD,OAAOC,sBAAsB,2BAAuB;AACpD,OAAOC,sBAAsB,2BAAuB;AACpD,OAAOC,wBAAwB,6BAAyB;AACxD,OAAOC,qBAAqB,yBAAqB;AACjD,OAAOC,wBAAwB,6BAAyB;AAiBxD;;;;;;;;;;;;;;;CAeC,GACD,SAASC,kBAAkBC,IAAY,EAAEC,EAA2B;IAClEC,OAAOC,cAAc,CAACC,MAAMC,SAAS,EAAEL,MAAM;QAC3CM,OAAOL;QACPM,YAAY;QACZC,UAAU;QACVC,cAAc;IAChB;AACF;AAEAV,kBAAkB,kBAAkB;IAClC,OAAON,iBAAiB,IAAI;AAC9B;AAEAM,kBAAkB,eAAe;IAC/B,OAAOP,cAAc,IAAI;AAC3B;AAEAO,kBAAkB,iBAAiB,SAEjCW,KAAa,EACbC,QAAgB;IAEhB,OAAOjB,iBAAiB,IAAI,EAAEgB,OAAOC;AACvC;AAEAZ,kBAAkB,iBAAiB,SAEjCW,KAAa,EACb,GAAGE,KAAe;IAElB,OAAOjB,iBAAiB,IAAI,EAAEe,UAAUE;AAC1C;AAEAb,kBAAkB,gBAAgB,SAA6Bc,IAAO;IACpE,OAAOhB,gBAAgB,IAAI,EAAEgB;AAC/B;AAEAd,kBAAkB,mBAAmB,SAA6BW,KAAa;IAC7E,OAAOd,mBAAmB,IAAI,EAAEc;AAClC;AAEAX,kBAAkB,oBAAoB,SAEpCW,KAAa,EACbG,IAAO;IAEP,OAAOf,mBAAmB,IAAI,EAAEY,OAAOG;AACzC;AAEAd,kBAAkB,YAAY;IAC5B,OAAO,IAAI,CAACe,MAAM,CAACC;AACrB"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Mutates the existing array by adding new items onto the array at the provided
19
+ * zero-based index. When the index is NaN, new items will be pushed onto the end
20
+ * of the array. When the index is greater than or equal to 0, new items will be
21
+ * pushed to the that index while any existing items previously located at or
22
+ * following the index will be shifted to right. Returns the mutated array.
23
+ * @param array - The array to mutate and push the new nodes onto
24
+ * @param index - The zero index to start the new nodes.
25
+ * @param items - New items to push onto the array
26
+ */
27
+ export declare function arrayPushAtIndex<T>(array: Array<T>, index: number, ...items: T[]): Array<T>;
28
+ export default arrayPushAtIndex;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ /**
17
+ * Mutates the existing array by adding new items onto the array at the provided
18
+ * zero-based index. When the index is NaN, new items will be pushed onto the end
19
+ * of the array. When the index is greater than or equal to 0, new items will be
20
+ * pushed to the that index while any existing items previously located at or
21
+ * following the index will be shifted to right. Returns the mutated array.
22
+ * @param array - The array to mutate and push the new nodes onto
23
+ * @param index - The zero index to start the new nodes.
24
+ * @param items - New items to push onto the array
25
+ */ export function arrayPushAtIndex(array, index, ...items) {
26
+ if (isNaN(index)) array.push(...items);
27
+ else array.splice(index, 0, ...items);
28
+ return array;
29
+ }
30
+ export default arrayPushAtIndex;
31
+
32
+ //# sourceMappingURL=array-push-at-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/array/array-push-at-index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Mutates the existing array by adding new items onto the array at the provided\n * zero-based index. When the index is NaN, new items will be pushed onto the end\n * of the array. When the index is greater than or equal to 0, new items will be\n * pushed to the that index while any existing items previously located at or\n * following the index will be shifted to right. Returns the mutated array.\n * @param array - The array to mutate and push the new nodes onto\n * @param index - The zero index to start the new nodes.\n * @param items - New items to push onto the array\n */\nexport function arrayPushAtIndex<T>(\n array: Array<T>,\n index: number,\n ...items: T[]\n): Array<T> {\n if (isNaN(index)) array.push(...items)\n else array.splice(index, 0, ...items)\n return array\n}\nexport default arrayPushAtIndex\n"],"names":["arrayPushAtIndex","array","index","items","isNaN","push","splice"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;CASC,GACD,OAAO,SAASA,iBACdC,KAAe,EACfC,KAAa,EACb,GAAGC,KAAU;IAEb,IAAIC,MAAMF,QAAQD,MAAMI,IAAI,IAAIF;SAC3BF,MAAMK,MAAM,CAACJ,OAAO,MAAMC;IAC/B,OAAOF;AACT;AACA,eAAeD,iBAAgB"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Remove an item from the array at the provided zero index
19
+ * @param array - Array list to remove the item from
20
+ * @param index - Index of item to remove
21
+ */
22
+ export declare function arrayRemoveAtIndex<T>(array: Array<T>, index: number): Array<T>;
23
+ export default arrayRemoveAtIndex;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ /**
17
+ * Remove an item from the array at the provided zero index
18
+ * @param array - Array list to remove the item from
19
+ * @param index - Index of item to remove
20
+ */ export function arrayRemoveAtIndex(array, index) {
21
+ array.splice(index, 1);
22
+ return array;
23
+ }
24
+ export default arrayRemoveAtIndex;
25
+
26
+ //# sourceMappingURL=array-remove-at-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/array/array-remove-at-index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n/**\n * Remove an item from the array at the provided zero index\n * @param array - Array list to remove the item from\n * @param index - Index of item to remove\n */\nexport function arrayRemoveAtIndex<T>(array: Array<T>, index: number): Array<T> {\n array.splice(index, 1)\n return array\n}\nexport default arrayRemoveAtIndex\n"],"names":["arrayRemoveAtIndex","array","index","splice"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD;;;;CAIC,GACD,OAAO,SAASA,mBAAsBC,KAAe,EAAEC,KAAa;IAClED,MAAME,MAAM,CAACD,OAAO;IACpB,OAAOD;AACT;AACA,eAAeD,mBAAkB"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Remove an item using strict equality when match
19
+ * @param array - Array to mutate and remove the match
20
+ * @param item - Item to search for strict equality comparison
21
+ */
22
+ export declare function arrayRemoveItem<T>(array: Array<T>, item: T): Array<T>;
23
+ export default arrayRemoveItem;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ /**
17
+ * Remove an item using strict equality when match
18
+ * @param array - Array to mutate and remove the match
19
+ * @param item - Item to search for strict equality comparison
20
+ */ export function arrayRemoveItem(array, item) {
21
+ const index = array.indexOf(item);
22
+ if (index >= 0) array.splice(index, 1);
23
+ return array;
24
+ }
25
+ export default arrayRemoveItem;
26
+
27
+ //# sourceMappingURL=array-remove-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/array/array-remove-item.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n/**\n * Remove an item using strict equality when match\n * @param array - Array to mutate and remove the match\n * @param item - Item to search for strict equality comparison\n */\nexport function arrayRemoveItem<T>(array: Array<T>, item: T): Array<T> {\n const index = array.indexOf(item)\n if (index >= 0) array.splice(index, 1)\n return array\n}\nexport default arrayRemoveItem\n"],"names":["arrayRemoveItem","array","item","index","indexOf","splice"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD;;;;CAIC,GACD,OAAO,SAASA,gBAAmBC,KAAe,EAAEC,IAAO;IACzD,MAAMC,QAAQF,MAAMG,OAAO,CAACF;IAC5B,IAAIC,SAAS,GAAGF,MAAMI,MAAM,CAACF,OAAO;IACpC,OAAOF;AACT;AACA,eAAeD,gBAAe"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Safe array, will always return an array
19
+ */
20
+ export declare function arraySafe<T>(val: T[] | T, or?: any, wrapValid?: boolean): T[];
21
+ export default arraySafe;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { _isArr } from "../guards/lib/_is-arr.js";
17
+ /**
18
+ * Safe array, will always return an array
19
+ */ export function arraySafe(val, or, wrapValid = false) {
20
+ if (_isArr(val)) return val;
21
+ if (wrapValid && val) return [
22
+ val
23
+ ];
24
+ if (_isArr(or)) return or;
25
+ return [];
26
+ }
27
+ export default arraySafe;
28
+
29
+ //# sourceMappingURL=array-safe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/array/array-safe.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _isArr } from '../guards/lib/_is-arr'\n\n\n/**\n * Safe array, will always return an array\n */\nexport function arraySafe<T>(val: T[] | T, or?: any, wrapValid = false): T[] {\n if (_isArr(val)) return val\n if (wrapValid && val) return [val]\n if (_isArr(or)) return or\n return []\n}\n\nexport default arraySafe\n"],"names":["_isArr","arraySafe","val","or","wrapValid"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,MAAM,QAAQ,2BAAuB;AAG9C;;CAEC,GACD,OAAO,SAASC,UAAaC,GAAY,EAAEC,EAAQ,EAAEC,YAAY,KAAK;IACpE,IAAIJ,OAAOE,MAAM,OAAOA;IACxB,IAAIE,aAAaF,KAAK,OAAO;QAACA;KAAI;IAClC,IAAIF,OAAOG,KAAK,OAAOA;IACvB,OAAO,EAAE;AACX;AAEA,eAAeF,UAAS"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Sort an array of objects by a specified property or property path, optionally second
19
+ * specify a secondary sorter for when left equals right
20
+ * @param {T[]} items
21
+ * @param {string} firstPath
22
+ * @param {string} secondPath
23
+ * @returns {T[]}
24
+ */
25
+ export declare function arraySortByDeepProperty<T>(items: T[], firstPath: string, secondPath?: string): T[];
26
+ export default arraySortByDeepProperty;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { objectGetDeepProperty } from "../object/object-get-deep-property.js";
17
+ /**
18
+ * Sort an array of objects by a specified property or property path, optionally second
19
+ * specify a secondary sorter for when left equals right
20
+ * @param {T[]} items
21
+ * @param {string} firstPath
22
+ * @param {string} secondPath
23
+ * @returns {T[]}
24
+ */ export function arraySortByDeepProperty(items, firstPath, secondPath) {
25
+ const lgr = (a, b, p)=>objectGetDeepProperty(a, p) > objectGetDeepProperty(b, p);
26
+ const eq = (a, b, p)=>objectGetDeepProperty(a, p) === objectGetDeepProperty(b, p);
27
+ return items.sort((a, b)=>{
28
+ if (lgr(a, b, firstPath)) return 1;
29
+ if (eq(a, b, firstPath)) {
30
+ if (!secondPath) return 0;
31
+ if (lgr(a, b, secondPath)) return 1;
32
+ if (eq(a, b, secondPath)) return 0;
33
+ }
34
+ return -1;
35
+ });
36
+ }
37
+ export default arraySortByDeepProperty;
38
+
39
+ //# sourceMappingURL=array-sort-by-deep-property.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/array/array-sort-by-deep-property.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {objectGetDeepProperty} from '../object/object-get-deep-property'\n\n\n/**\n * Sort an array of objects by a specified property or property path, optionally second\n * specify a secondary sorter for when left equals right\n * @param {T[]} items\n * @param {string} firstPath\n * @param {string} secondPath\n * @returns {T[]}\n */\nexport function arraySortByDeepProperty<T>(\n items: T[],\n firstPath: string,\n secondPath?: string,\n): T[] {\n const lgr = (a: T, b: T, p: string) => objectGetDeepProperty(a, p) > objectGetDeepProperty(b, p)\n const eq = (a: T, b: T, p: string) => objectGetDeepProperty(a, p) === objectGetDeepProperty(b, p)\n return items.sort((a, b) => {\n if (lgr(a, b, firstPath)) return 1\n if (eq(a, b, firstPath)) {\n if (!secondPath) return 0\n if (lgr(a, b, secondPath)) return 1\n if (eq(a, b, secondPath)) return 0\n }\n return -1\n })\n}\n\nexport default arraySortByDeepProperty\n"],"names":["objectGetDeepProperty","arraySortByDeepProperty","items","firstPath","secondPath","lgr","a","b","p","eq","sort"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAAQA,qBAAqB,QAAO,wCAAoC;AAGxE;;;;;;;CAOC,GACD,OAAO,SAASC,wBACdC,KAAU,EACVC,SAAiB,EACjBC,UAAmB;IAEnB,MAAMC,MAAM,CAACC,GAAMC,GAAMC,IAAcR,sBAAsBM,GAAGE,KAAKR,sBAAsBO,GAAGC;IAC9F,MAAMC,KAAK,CAACH,GAAMC,GAAMC,IAAcR,sBAAsBM,GAAGE,OAAOR,sBAAsBO,GAAGC;IAC/F,OAAON,MAAMQ,IAAI,CAAC,CAACJ,GAAGC;QACpB,IAAIF,IAAIC,GAAGC,GAAGJ,YAAY,OAAO;QACjC,IAAIM,GAAGH,GAAGC,GAAGJ,YAAY;YACvB,IAAI,CAACC,YAAY,OAAO;YACxB,IAAIC,IAAIC,GAAGC,GAAGH,aAAa,OAAO;YAClC,IAAIK,GAAGH,GAAGC,GAAGH,aAAa,OAAO;QACnC;QACA,OAAO,CAAC;IACV;AACF;AAEA,eAAeH,wBAAuB"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Sort iterable by property or index returned from callbackFn
19
+ * @export`
20
+ * @param {T[]} target
21
+ * @param {(item: T) => (string | number)} callbackFn
22
+ * @param thisArg
23
+ * @returns {T[]}
24
+ */
25
+ export declare function arraySortBy<T>(target: T[], callbackFn: (item: T, target: T[]) => string | number, thisArg?: ThisType<unknown>): T[];
26
+ export default arraySortBy;