@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,46 @@
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
+ import type { CrudModel } from '@aglyn/shared-data-types';
18
+ /**
19
+ * Methods (set, get, has, del) to c.r.u.d. an index of the data property
20
+ *
21
+ * @export
22
+ * @abstract
23
+ * @class Crud
24
+ * @implements {Crud<T>}
25
+ * @template T
26
+ */
27
+ export declare abstract class Crud<T = any> implements CrudModel<T> {
28
+ model: T;
29
+ /**
30
+ * Creates an instance of Crud.
31
+ * @param {T} [model={} as any]
32
+ * @memberof Crud
33
+ */
34
+ constructor(model?: T);
35
+ /** @inheritdoc */
36
+ toJSON(): T;
37
+ /** @inheritdoc */
38
+ set<K extends keyof T>(id: K, value: any): this;
39
+ /** @inheritdoc */
40
+ get<K extends keyof T>(id: K): T[K] | null;
41
+ /** @inheritdoc */
42
+ has<K extends keyof T>(id: K): boolean;
43
+ /** @inheritdoc */
44
+ delete<K extends keyof T>(id: K): this;
45
+ private get hasOwnProperty();
46
+ }
@@ -0,0 +1,55 @@
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
+ */ // eslint-disable-next-line @nx/enforce-module-boundaries
17
+ /**
18
+ * Methods (set, get, has, del) to c.r.u.d. an index of the data property
19
+ *
20
+ * @export
21
+ * @abstract
22
+ * @class Crud
23
+ * @implements {Crud<T>}
24
+ * @template T
25
+ */ export class Crud {
26
+ /** @inheritdoc */ toJSON() {
27
+ return this.model;
28
+ }
29
+ /** @inheritdoc */ set(id, value) {
30
+ this.model[id] = value;
31
+ return this;
32
+ }
33
+ /** @inheritdoc */ get(id) {
34
+ return this.model[id];
35
+ }
36
+ /** @inheritdoc */ has(id) {
37
+ return this.hasOwnProperty.call(this.model, id);
38
+ }
39
+ /** @inheritdoc */ delete(id) {
40
+ delete this.model[id];
41
+ return this;
42
+ }
43
+ get hasOwnProperty() {
44
+ return Object.prototype.hasOwnProperty;
45
+ }
46
+ /**
47
+ * Creates an instance of Crud.
48
+ * @param {T} [model={} as any]
49
+ * @memberof Crud
50
+ */ constructor(model = {}){
51
+ this.model = model;
52
+ }
53
+ }
54
+
55
+ //# sourceMappingURL=crud.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/shared/util/tools/src/lib/crud.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// eslint-disable-next-line @nx/enforce-module-boundaries\nimport type { CrudModel } from '@aglyn/shared-data-types'\n\n/**\n * Methods (set, get, has, del) to c.r.u.d. an index of the data property\n *\n * @export\n * @abstract\n * @class Crud\n * @implements {Crud<T>}\n * @template T\n */\nexport abstract class Crud<T = any> implements CrudModel<T> {\n /**\n * Creates an instance of Crud.\n * @param {T} [model={} as any]\n * @memberof Crud\n */\n constructor(public model: T = {} as any) {}\n\n /** @inheritdoc */\n public toJSON(): T {\n return this.model\n }\n\n /** @inheritdoc */\n public set<K extends keyof T>(id: K, value: any): this {\n this.model[id] = value\n return this\n }\n\n /** @inheritdoc */\n public get<K extends keyof T>(id: K): T[K] | null {\n return this.model[id]\n }\n\n /** @inheritdoc */\n public has<K extends keyof T>(id: K): boolean {\n return this.hasOwnProperty.call(this.model, id)\n }\n\n /** @inheritdoc */\n public delete<K extends keyof T>(id: K): this {\n delete this.model[id]\n return this\n }\n\n private get hasOwnProperty() {\n return Object.prototype.hasOwnProperty\n }\n}\n"],"names":["Crud","toJSON","model","set","id","value","get","has","hasOwnProperty","call","delete","Object","prototype"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,yDAAyD;AAGzD;;;;;;;;CAQC,GACD,OAAO,MAAeA;IAQpB,gBAAgB,GAChB,AAAOC,SAAY;QACjB,OAAO,IAAI,CAACC,KAAK;IACnB;IAEA,gBAAgB,GAChB,AAAOC,IAAuBC,EAAK,EAAEC,KAAU,EAAQ;QACrD,IAAI,CAACH,KAAK,CAACE,GAAG,GAAGC;QACjB,OAAO,IAAI;IACb;IAEA,gBAAgB,GAChB,AAAOC,IAAuBF,EAAK,EAAe;QAChD,OAAO,IAAI,CAACF,KAAK,CAACE,GAAG;IACvB;IAEA,gBAAgB,GAChB,AAAOG,IAAuBH,EAAK,EAAW;QAC5C,OAAO,IAAI,CAACI,cAAc,CAACC,IAAI,CAAC,IAAI,CAACP,KAAK,EAAEE;IAC9C;IAEA,gBAAgB,GAChB,AAAOM,OAA0BN,EAAK,EAAQ;QAC5C,OAAO,IAAI,CAACF,KAAK,CAACE,GAAG;QACrB,OAAO,IAAI;IACb;IAEA,IAAYI,iBAAiB;QAC3B,OAAOG,OAAOC,SAAS,CAACJ,cAAc;IACxC;IApCA;;;;GAIC,GACD,YAAY,AAAON,QAAW,CAAC,CAAQ,CAAE;aAAtBA,QAAAA;IAAuB;AAgC5C"}
@@ -0,0 +1,41 @@
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
+ export type Transform = {
18
+ x: number;
19
+ y: number;
20
+ scaleX: number;
21
+ scaleY: number;
22
+ };
23
+ export interface Transition {
24
+ property: string;
25
+ easing: string;
26
+ duration: number;
27
+ }
28
+ export declare const CSS: Readonly<{
29
+ Translate: {
30
+ toString(transform: Transform | null): string | undefined;
31
+ };
32
+ Scale: {
33
+ toString(transform: Transform | null): string | undefined;
34
+ };
35
+ Transform: {
36
+ toString(transform: Transform | null): string | undefined;
37
+ };
38
+ Transition: {
39
+ toString({ property, duration, easing }: Transition): string;
40
+ };
41
+ }>;
package/src/lib/css.js ADDED
@@ -0,0 +1,54 @@
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
+ */ export const CSS = Object.freeze({
17
+ Translate: {
18
+ toString (transform) {
19
+ if (!transform) {
20
+ return undefined;
21
+ }
22
+ const x = transform.x ? Math.round(transform.x) : 0;
23
+ const y = transform.y ? Math.round(transform.y) : 0;
24
+ return `translate3d(${x}px, ${y}px, 0)`;
25
+ }
26
+ },
27
+ Scale: {
28
+ toString (transform) {
29
+ if (!transform) {
30
+ return undefined;
31
+ }
32
+ const { scaleX, scaleY } = transform;
33
+ return `scaleX(${scaleX}) scaleY(${scaleY})`;
34
+ }
35
+ },
36
+ Transform: {
37
+ toString (transform) {
38
+ if (!transform) {
39
+ return undefined;
40
+ }
41
+ return [
42
+ CSS.Translate.toString(transform),
43
+ CSS.Scale.toString(transform)
44
+ ].join(' ');
45
+ }
46
+ },
47
+ Transition: {
48
+ toString ({ property, duration, easing }) {
49
+ return `${property} ${duration}ms ${easing}`;
50
+ }
51
+ }
52
+ });
53
+
54
+ //# sourceMappingURL=css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/shared/util/tools/src/lib/css.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 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\nexport type Transform = {\n x: number;\n y: number;\n scaleX: number;\n scaleY: number;\n};\n\nexport interface Transition {\n property: string;\n easing: string;\n duration: number;\n}\n\nexport const CSS = Object.freeze({\n Translate: {\n toString(transform: Transform | null): string | undefined {\n if (!transform) {\n return undefined;\n }\n\n const x = transform.x ? Math.round(transform.x) : 0\n const y = transform.y ? Math.round(transform.y) : 0\n\n return `translate3d(${x}px, ${y}px, 0)`;\n },\n },\n Scale: {\n toString(transform: Transform | null): string | undefined {\n if (!transform) {\n return undefined;\n }\n\n const {scaleX, scaleY} = transform;\n\n return `scaleX(${scaleX}) scaleY(${scaleY})`;\n },\n },\n Transform: {\n toString(transform: Transform | null): string | undefined {\n if (!transform) {\n return undefined;\n }\n\n return [\n CSS.Translate.toString(transform),\n CSS.Scale.toString(transform),\n ].join(' ');\n },\n },\n Transition: {\n toString({property, duration, easing}: Transition) {\n return `${property} ${duration}ms ${easing}`;\n },\n },\n})\n"],"names":["CSS","Object","freeze","Translate","toString","transform","undefined","x","Math","round","y","Scale","scaleX","scaleY","Transform","join","Transition","property","duration","easing"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAeD,OAAO,MAAMA,MAAMC,OAAOC,MAAM,CAAC;IAC/BC,WAAW;QACTC,UAASC,SAA2B;YAClC,IAAI,CAACA,WAAW;gBACd,OAAOC;YACT;YAEA,MAAMC,IAAIF,UAAUE,CAAC,GAAGC,KAAKC,KAAK,CAACJ,UAAUE,CAAC,IAAI;YAClD,MAAMG,IAAIL,UAAUK,CAAC,GAAGF,KAAKC,KAAK,CAACJ,UAAUK,CAAC,IAAI;YAElD,OAAO,CAAC,YAAY,EAAEH,EAAE,IAAI,EAAEG,EAAE,MAAM,CAAC;QACzC;IACF;IACAC,OAAO;QACLP,UAASC,SAA2B;YAClC,IAAI,CAACA,WAAW;gBACd,OAAOC;YACT;YAEA,MAAM,EAACM,MAAM,EAAEC,MAAM,EAAC,GAAGR;YAEzB,OAAO,CAAC,OAAO,EAAEO,OAAO,SAAS,EAAEC,OAAO,CAAC,CAAC;QAC9C;IACF;IACAC,WAAW;QACTV,UAASC,SAA2B;YAClC,IAAI,CAACA,WAAW;gBACd,OAAOC;YACT;YAEA,OAAO;gBACLN,IAAIG,SAAS,CAACC,QAAQ,CAACC;gBACvBL,IAAIW,KAAK,CAACP,QAAQ,CAACC;aACpB,CAACU,IAAI,CAAC;QACT;IACF;IACAC,YAAY;QACVZ,UAAS,EAACa,QAAQ,EAAEC,QAAQ,EAAEC,MAAM,EAAa;YAC/C,OAAO,GAAGF,SAAS,CAAC,EAAEC,SAAS,GAAG,EAAEC,QAAQ;QAC9C;IACF;AACF,GAAE"}
@@ -0,0 +1,38 @@
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
+ * HTML-escape a value for interpolation into markup assembled as a string.
19
+ *
20
+ * Every place in this repo that builds HTML by concatenation rather than
21
+ * through React needs this, and each one that wrote its own arrived at a
22
+ * different set of characters. Two of them omitted `'`, which is not a
23
+ * cosmetic difference: single quotes delimit attributes just as well as
24
+ * double quotes do, so `<a href='…'>` with an unescaped apostrophe in the
25
+ * value is an attribute break, and an attribute break is a tag.
26
+ *
27
+ * The five characters below are the complete set for both HTML text and
28
+ * attribute values. `'` becomes `&#39;` rather than `&apos;`, which HTML 4
29
+ * does not define. Non-string input coerces rather than throwing: callers
30
+ * read optional fields off stored documents, and a `null` slipping through
31
+ * must produce empty text, never a crash in the middle of rendering a page
32
+ * somebody is already waiting on.
33
+ *
34
+ * Deliberately NOT re-exported from this library's index — reach it as
35
+ * `@aglyn/shared-util-tools/escape-html`. The index note records why.
36
+ */
37
+ export declare function escapeHtml(value: unknown): string;
38
+ export default escapeHtml;
@@ -0,0 +1,47 @@
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
+ * HTML-escape a value for interpolation into markup assembled as a string.
18
+ *
19
+ * Every place in this repo that builds HTML by concatenation rather than
20
+ * through React needs this, and each one that wrote its own arrived at a
21
+ * different set of characters. Two of them omitted `'`, which is not a
22
+ * cosmetic difference: single quotes delimit attributes just as well as
23
+ * double quotes do, so `<a href='…'>` with an unescaped apostrophe in the
24
+ * value is an attribute break, and an attribute break is a tag.
25
+ *
26
+ * The five characters below are the complete set for both HTML text and
27
+ * attribute values. `'` becomes `&#39;` rather than `&apos;`, which HTML 4
28
+ * does not define. Non-string input coerces rather than throwing: callers
29
+ * read optional fields off stored documents, and a `null` slipping through
30
+ * must produce empty text, never a crash in the middle of rendering a page
31
+ * somebody is already waiting on.
32
+ *
33
+ * Deliberately NOT re-exported from this library's index — reach it as
34
+ * `@aglyn/shared-util-tools/escape-html`. The index note records why.
35
+ */ export function escapeHtml(value) {
36
+ if (value == null) return '';
37
+ return String(value).replace(/[&<>"']/g, (character)=>({
38
+ '&': '&amp;',
39
+ '<': '&lt;',
40
+ '>': '&gt;',
41
+ '"': '&quot;',
42
+ "'": '&#39;'
43
+ })[character]);
44
+ }
45
+ export default escapeHtml;
46
+
47
+ //# sourceMappingURL=escape-html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/shared/util/tools/src/lib/escape-html.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 * HTML-escape a value for interpolation into markup assembled as a string.\n *\n * Every place in this repo that builds HTML by concatenation rather than\n * through React needs this, and each one that wrote its own arrived at a\n * different set of characters. Two of them omitted `'`, which is not a\n * cosmetic difference: single quotes delimit attributes just as well as\n * double quotes do, so `<a href='…'>` with an unescaped apostrophe in the\n * value is an attribute break, and an attribute break is a tag.\n *\n * The five characters below are the complete set for both HTML text and\n * attribute values. `'` becomes `&#39;` rather than `&apos;`, which HTML 4\n * does not define. Non-string input coerces rather than throwing: callers\n * read optional fields off stored documents, and a `null` slipping through\n * must produce empty text, never a crash in the middle of rendering a page\n * somebody is already waiting on.\n *\n * Deliberately NOT re-exported from this library's index — reach it as\n * `@aglyn/shared-util-tools/escape-html`. The index note records why.\n */\nexport function escapeHtml(value: unknown): string {\n if (value == null) return ''\n return String(value).replace(\n /[&<>\"']/g,\n (character) =>\n ({\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n \"'\": '&#39;',\n })[character] as string,\n )\n}\n\nexport default escapeHtml\n"],"names":["escapeHtml","value","String","replace","character"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,SAASA,WAAWC,KAAc;IACvC,IAAIA,SAAS,MAAM,OAAO;IAC1B,OAAOC,OAAOD,OAAOE,OAAO,CAC1B,YACA,CAACC,YACC,AAAC,CAAA;YACC,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;QACP,CAAA,CAAE,CAACA,UAAU;AAEnB;AAEA,eAAeJ,WAAU"}
@@ -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 FalsyParams = unknown[];
18
+ /**
19
+ * Shortcut for checking multiple falsy values e.g., `!Boolean(i of val)`
20
+ * @returns return true unless any value is truthy otherwise returns false
21
+ */
22
+ export declare function falsy(...val: FalsyParams): boolean;
23
+ export default falsy;
@@ -0,0 +1,25 @@
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 truthy from "./truthy.js";
17
+ /**
18
+ * Shortcut for checking multiple falsy values e.g., `!Boolean(i of val)`
19
+ * @returns return true unless any value is truthy otherwise returns false
20
+ */ export function falsy(...val) {
21
+ return !truthy(...val);
22
+ }
23
+ export default falsy;
24
+
25
+ //# sourceMappingURL=falsy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/shared/util/tools/src/lib/falsy.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 truthy from './truthy'\n\n\nexport type FalsyParams = unknown[]\n\n/**\n * Shortcut for checking multiple falsy values e.g., `!Boolean(i of val)`\n * @returns return true unless any value is truthy otherwise returns false\n */\nexport function falsy(...val: FalsyParams): boolean {\n return !truthy(...val)\n}\nexport default falsy\n"],"names":["truthy","falsy","val"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,OAAOA,YAAY,cAAU;AAK7B;;;CAGC,GACD,OAAO,SAASC,MAAM,GAAGC,GAAgB;IACvC,OAAO,CAACF,UAAUE;AACpB;AACA,eAAeD,MAAK"}
@@ -0,0 +1,46 @@
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 declare const fnNameMatchRegex: RegExp;
18
+ export declare const getPureFunctionName: (fn: any) => string;
19
+ /**
20
+ *
21
+ */
22
+ export declare const getFunctionComponentName: (Component: {
23
+ displayName?: string;
24
+ name?: string;
25
+ }, fallback?: string) => string;
26
+ export declare const getWrappedComponentName: (outerType: {
27
+ displayName?: string;
28
+ }, innerType: {
29
+ displayName?: string;
30
+ name?: string;
31
+ }, wrapperName: string) => string;
32
+ /**
33
+ * Get the display name of a function, react component, object, or string
34
+ * @example getDisplayName('hello') => 'hello'
35
+ * @example getDisplayName(null, 'N/A') => 'N/A'
36
+ * @example getDisplayName(getCount) => 'getCount'
37
+ * @example getDisplayName(class MyComp {displayName = 'My'}) => 'My'
38
+ * @example
39
+ * MyComp = () => {...};
40
+ * MyComp.displayName = 'MyComp'
41
+ MyComp.aglyn = true;
42
+ * MyComp = forwardRef(MyComp)
43
+ * getDisplayName(MyComp) => 'My'
44
+ */
45
+ export declare function getDisplayName(fn: any, fallback?: string): string;
46
+ export default getDisplayName;
@@ -0,0 +1,64 @@
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
+ */ // https://github.com/JamesMGreene/Function.name/blob/58b314d4a983110c3682f1228f845d39ccca1817/Function.name.js#L3
17
+ export const fnNameMatchRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;
18
+ export const getPureFunctionName = (fn)=>{
19
+ const match = `${fn}`.match(fnNameMatchRegex);
20
+ const name = match && match[1];
21
+ return name || '';
22
+ };
23
+ /**
24
+ *
25
+ */ export const getFunctionComponentName = (Component, fallback = 'fn')=>Component.displayName || Component.name || getPureFunctionName(Component) || fallback;
26
+ export const getWrappedComponentName = (outerType, innerType, wrapperName)=>{
27
+ const functionName = getFunctionComponentName(innerType);
28
+ return outerType.displayName || (functionName !== '' ? `${wrapperName}(${functionName})` : wrapperName);
29
+ };
30
+ /**
31
+ * Get the display name of a function, react component, object, or string
32
+ * @example getDisplayName('hello') => 'hello'
33
+ * @example getDisplayName(null, 'N/A') => 'N/A'
34
+ * @example getDisplayName(getCount) => 'getCount'
35
+ * @example getDisplayName(class MyComp {displayName = 'My'}) => 'My'
36
+ * @example
37
+ * MyComp = () => {...};
38
+ * MyComp.displayName = 'MyComp'
39
+ MyComp.aglyn = true;
40
+ * MyComp = forwardRef(MyComp)
41
+ * getDisplayName(MyComp) => 'My'
42
+ */ export function getDisplayName(fn, fallback = 'Component') {
43
+ if (fn == null) {
44
+ return fallback;
45
+ }
46
+ if (typeof fn === 'string') {
47
+ return fn;
48
+ }
49
+ if (typeof fn === 'function') {
50
+ return getFunctionComponentName(fn, fallback);
51
+ }
52
+ if (typeof fn === 'object') {
53
+ switch(fn.$$typeof){
54
+ case Symbol.for('react.forward_ref') || 0xead0:
55
+ return getWrappedComponentName(fn, fn.render, 'ForwardRef');
56
+ default:
57
+ return fallback;
58
+ }
59
+ }
60
+ return fallback;
61
+ }
62
+ export default getDisplayName;
63
+
64
+ //# sourceMappingURL=get-display-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/shared/util/tools/src/lib/get-display-name.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// https://github.com/JamesMGreene/Function.name/blob/58b314d4a983110c3682f1228f845d39ccca1817/Function.name.js#L3\nexport const fnNameMatchRegex = /^\\s*function(?:\\s|\\s*\\/\\*.*\\*\\/\\s*)+([^(\\s/]*)\\s*/\nexport const getPureFunctionName = (fn: any) => {\n const match = `${fn}`.match(fnNameMatchRegex)\n const name = match && match[1]\n return name || ''\n}\n\n/**\n *\n */\nexport const getFunctionComponentName = (Component: { displayName?: string; name?: string }, fallback = 'fn') => (\n Component.displayName\n || Component.name\n || getPureFunctionName(Component)\n || fallback\n)\n\nexport const getWrappedComponentName = (outerType: { displayName?: string }, innerType: { displayName?: string; name?: string }, wrapperName: string) => {\n const functionName = getFunctionComponentName(innerType)\n return (\n outerType.displayName\n || (\n functionName !== ''\n ? `${wrapperName}(${functionName})`\n : wrapperName\n )\n )\n}\n\n/**\n * Get the display name of a function, react component, object, or string\n * @example getDisplayName('hello') => 'hello'\n * @example getDisplayName(null, 'N/A') => 'N/A'\n * @example getDisplayName(getCount) => 'getCount'\n * @example getDisplayName(class MyComp {displayName = 'My'}) => 'My'\n * @example\n * MyComp = () => {...};\n * MyComp.displayName = 'MyComp'\nMyComp.aglyn = true;\n * MyComp = forwardRef(MyComp)\n * getDisplayName(MyComp) => 'My'\n */\nexport function getDisplayName(fn: any, fallback = 'Component'): string {\n if (fn == null) {\n return fallback\n }\n\n if (typeof fn === 'string') {\n return fn\n }\n\n if (typeof fn === 'function') {\n return getFunctionComponentName(fn, fallback)\n }\n\n if (typeof fn === 'object') {\n switch (fn.$$typeof) {\n\n case Symbol.for('react.forward_ref') || 0xead0:\n return getWrappedComponentName(fn, fn.render, 'ForwardRef')\n\n default:\n return fallback\n }\n }\n\n return fallback\n}\n\nexport default getDisplayName\n"],"names":["fnNameMatchRegex","getPureFunctionName","fn","match","name","getFunctionComponentName","Component","fallback","displayName","getWrappedComponentName","outerType","innerType","wrapperName","functionName","getDisplayName","$$typeof","Symbol","for","render"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,kHAAkH;AAClH,OAAO,MAAMA,mBAAmB,oDAAmD;AACnF,OAAO,MAAMC,sBAAsB,CAACC;IAClC,MAAMC,QAAQ,GAAGD,IAAI,CAACC,KAAK,CAACH;IAC5B,MAAMI,OAAOD,SAASA,KAAK,CAAC,EAAE;IAC9B,OAAOC,QAAQ;AACjB,EAAC;AAED;;CAEC,GACD,OAAO,MAAMC,2BAA2B,CAACC,WAAoDC,WAAW,IAAI,GAC1GD,UAAUE,WAAW,IAClBF,UAAUF,IAAI,IACdH,oBAAoBK,cACpBC,SACJ;AAED,OAAO,MAAME,0BAA0B,CAACC,WAAqCC,WAAoDC;IAC/H,MAAMC,eAAeR,yBAAyBM;IAC9C,OACED,UAAUF,WAAW,IAEnBK,CAAAA,iBAAiB,KACb,GAAGD,YAAY,CAAC,EAAEC,aAAa,CAAC,CAAC,GACjCD,WAAU;AAGpB,EAAC;AAED;;;;;;;;;;;;CAYC,GACD,OAAO,SAASE,eAAeZ,EAAO,EAAEK,WAAW,WAAW;IAC5D,IAAIL,MAAM,MAAM;QACd,OAAOK;IACT;IAEA,IAAI,OAAOL,OAAO,UAAU;QAC1B,OAAOA;IACT;IAEA,IAAI,OAAOA,OAAO,YAAY;QAC5B,OAAOG,yBAAyBH,IAAIK;IACtC;IAEA,IAAI,OAAOL,OAAO,UAAU;QAC1B,OAAQA,GAAGa,QAAQ;YAEjB,KAAKC,OAAOC,GAAG,CAAC,wBAAwB;gBACtC,OAAOR,wBAAwBP,IAAIA,GAAGgB,MAAM,EAAE;YAEhD;gBACE,OAAOX;QACX;IACF;IAEA,OAAOA;AACT;AAEA,eAAeO,eAAc"}
@@ -0,0 +1,30 @@
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
+ * Get safe property
19
+ *
20
+ * @see objectGetDeepProperty
21
+ * @see objectSetDeepProperty
22
+ *
23
+ * @export
24
+ * @template T
25
+ * @template K
26
+ * @param {T} obj
27
+ * @param {K} key
28
+ * @returns {T[K]}
29
+ */
30
+ export declare function getProperty<T, K extends keyof T>(obj: T, key: K): T[K] | undefined;
@@ -0,0 +1,36 @@
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 { _hasOwnProperty, _isObj } from "./guards/index.js";
17
+ /**
18
+ * Get safe property
19
+ *
20
+ * @see objectGetDeepProperty
21
+ * @see objectSetDeepProperty
22
+ *
23
+ * @export
24
+ * @template T
25
+ * @template K
26
+ * @param {T} obj
27
+ * @param {K} key
28
+ * @returns {T[K]}
29
+ */ export function getProperty(obj, key) {
30
+ if (!_isObj(obj) || !_hasOwnProperty(key, obj)) {
31
+ return undefined;
32
+ }
33
+ return obj[key];
34
+ }
35
+
36
+ //# sourceMappingURL=get-property.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/shared/util/tools/src/lib/get-property.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 { _hasOwnProperty, _isObj } from './guards'\n\n\n/**\n * Get safe property\n *\n * @see objectGetDeepProperty\n * @see objectSetDeepProperty\n *\n * @export\n * @template T\n * @template K\n * @param {T} obj\n * @param {K} key\n * @returns {T[K]}\n */\nexport function getProperty<T, K extends keyof T>(\n obj: T,\n key: K,\n): T[K] | undefined {\n if (!_isObj(obj) || !_hasOwnProperty(key, obj)) {\n return undefined\n }\n return obj[key]\n}\n"],"names":["_hasOwnProperty","_isObj","getProperty","obj","key","undefined"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,eAAe,EAAEC,MAAM,QAAQ,oBAAU;AAGlD;;;;;;;;;;;;CAYC,GACD,OAAO,SAASC,YACdC,GAAM,EACNC,GAAM;IAEN,IAAI,CAACH,OAAOE,QAAQ,CAACH,gBAAgBI,KAAKD,MAAM;QAC9C,OAAOE;IACT;IACA,OAAOF,GAAG,CAACC,IAAI;AACjB"}
@@ -0,0 +1,23 @@
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
+ * Return a static property of the
19
+ * @param {keyof any} field
20
+ * @param thisArg
21
+ * @returns {any}
22
+ */
23
+ export declare function getStaticField<T>(field: keyof any, thisArg: T): any;
@@ -0,0 +1,25 @@
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
+ * Return a static property of the
18
+ * @param {keyof any} field
19
+ * @param thisArg
20
+ * @returns {any}
21
+ */ export function getStaticField(field, thisArg) {
22
+ return Object.getPrototypeOf(thisArg).constructor[field];
23
+ }
24
+
25
+ //# sourceMappingURL=get-static-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/shared/util/tools/src/lib/get-static-field.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 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 * Return a static property of the\n * @param {keyof any} field\n * @param thisArg\n * @returns {any}\n */\nexport function getStaticField<T>(field: keyof any, thisArg: T): any {\n return Object.getPrototypeOf(thisArg).constructor[field]\n}\n"],"names":["getStaticField","field","thisArg","Object","getPrototypeOf"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;CAKC,GACD,OAAO,SAASA,eAAkBC,KAAgB,EAAEC,OAAU;IAC5D,OAAOC,OAAOC,cAAc,CAACF,SAAS,WAAW,CAACD,MAAM;AAC1D"}