@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.
- package/LICENSE +201 -0
- package/README.md +7 -0
- package/package.json +39 -0
- package/src/index.d.ts +72 -0
- package/src/index.js +87 -0
- package/src/index.js.map +1 -0
- package/src/lib/apply-mixins.d.ts +24 -0
- package/src/lib/apply-mixins.js +31 -0
- package/src/lib/apply-mixins.js.map +1 -0
- package/src/lib/array/array-copy-deep.d.ts +6 -0
- package/src/lib/array/array-copy-deep.js +25 -0
- package/src/lib/array/array-copy-deep.js.map +1 -0
- package/src/lib/array/array-copy-shallow.d.ts +19 -0
- package/src/lib/array/array-copy-shallow.js +20 -0
- package/src/lib/array/array-copy-shallow.js.map +1 -0
- package/src/lib/array/array-from-length.d.ts +18 -0
- package/src/lib/array/array-from-length.js +23 -0
- package/src/lib/array/array-from-length.js.map +1 -0
- package/src/lib/array/array-from.d.ts +24 -0
- package/src/lib/array/array-from.js +26 -0
- package/src/lib/array/array-from.js.map +1 -0
- package/src/lib/array/array-move-at-index.d.ts +24 -0
- package/src/lib/array/array-move-at-index.js +32 -0
- package/src/lib/array/array-move-at-index.js.map +1 -0
- package/src/lib/array/array-of-entries-to-object.d.ts +23 -0
- package/src/lib/array/array-of-entries-to-object.js +26 -0
- package/src/lib/array/array-of-entries-to-object.js.map +1 -0
- package/src/lib/array/array-overrides.d.ts +29 -0
- package/src/lib/array/array-overrides.js +71 -0
- package/src/lib/array/array-overrides.js.map +1 -0
- package/src/lib/array/array-push-at-index.d.ts +28 -0
- package/src/lib/array/array-push-at-index.js +32 -0
- package/src/lib/array/array-push-at-index.js.map +1 -0
- package/src/lib/array/array-remove-at-index.d.ts +23 -0
- package/src/lib/array/array-remove-at-index.js +26 -0
- package/src/lib/array/array-remove-at-index.js.map +1 -0
- package/src/lib/array/array-remove-item.d.ts +23 -0
- package/src/lib/array/array-remove-item.js +27 -0
- package/src/lib/array/array-remove-item.js.map +1 -0
- package/src/lib/array/array-safe.d.ts +21 -0
- package/src/lib/array/array-safe.js +29 -0
- package/src/lib/array/array-safe.js.map +1 -0
- package/src/lib/array/array-sort-by-deep-property.d.ts +26 -0
- package/src/lib/array/array-sort-by-deep-property.js +39 -0
- package/src/lib/array/array-sort-by-deep-property.js.map +1 -0
- package/src/lib/array/array-sort-by.d.ts +26 -0
- package/src/lib/array/array-sort-by.js +36 -0
- package/src/lib/array/array-sort-by.js.map +1 -0
- package/src/lib/array/array-update-at-index.d.ts +18 -0
- package/src/lib/array/array-update-at-index.js +22 -0
- package/src/lib/array/array-update-at-index.js.map +1 -0
- package/src/lib/array/array-update.d.ts +23 -0
- package/src/lib/array/array-update.js +25 -0
- package/src/lib/array/array-update.js.map +1 -0
- package/src/lib/bitwise/bitwise-has-all-attributes.d.ts +18 -0
- package/src/lib/bitwise/bitwise-has-all-attributes.js +21 -0
- package/src/lib/bitwise/bitwise-has-all-attributes.js.map +1 -0
- package/src/lib/bitwise/bitwise-has-attribute.d.ts +18 -0
- package/src/lib/bitwise/bitwise-has-attribute.js +21 -0
- package/src/lib/bitwise/bitwise-has-attribute.js.map +1 -0
- package/src/lib/bitwise/bitwise-has-only-attributes.d.ts +18 -0
- package/src/lib/bitwise/bitwise-has-only-attributes.js +21 -0
- package/src/lib/bitwise/bitwise-has-only-attributes.js.map +1 -0
- package/src/lib/contrast.d.ts +65 -0
- package/src/lib/contrast.js +78 -0
- package/src/lib/contrast.js.map +1 -0
- package/src/lib/copy-shallow.d.ts +19 -0
- package/src/lib/copy-shallow.js +20 -0
- package/src/lib/copy-shallow.js.map +1 -0
- package/src/lib/copy.d.ts +19 -0
- package/src/lib/copy.js +20 -0
- package/src/lib/copy.js.map +1 -0
- package/src/lib/create-chained-function.d.ts +38 -0
- package/src/lib/create-chained-function.js +46 -0
- package/src/lib/create-chained-function.js.map +1 -0
- package/src/lib/crud.d.ts +46 -0
- package/src/lib/crud.js +55 -0
- package/src/lib/crud.js.map +1 -0
- package/src/lib/css.d.ts +41 -0
- package/src/lib/css.js +54 -0
- package/src/lib/css.js.map +1 -0
- package/src/lib/escape-html.d.ts +38 -0
- package/src/lib/escape-html.js +47 -0
- package/src/lib/escape-html.js.map +1 -0
- package/src/lib/falsy.d.ts +23 -0
- package/src/lib/falsy.js +25 -0
- package/src/lib/falsy.js.map +1 -0
- package/src/lib/get-display-name.d.ts +46 -0
- package/src/lib/get-display-name.js +64 -0
- package/src/lib/get-display-name.js.map +1 -0
- package/src/lib/get-property.d.ts +30 -0
- package/src/lib/get-property.js +36 -0
- package/src/lib/get-property.js.map +1 -0
- package/src/lib/get-static-field.d.ts +23 -0
- package/src/lib/get-static-field.js +25 -0
- package/src/lib/get-static-field.js.map +1 -0
- package/src/lib/guards/index.d.ts +46 -0
- package/src/lib/guards/index.js +47 -0
- package/src/lib/guards/index.js.map +1 -0
- package/src/lib/guards/lib/_has-own-property.d.ts +24 -0
- package/src/lib/guards/lib/_has-own-property.js +27 -0
- package/src/lib/guards/lib/_has-own-property.js.map +1 -0
- package/src/lib/guards/lib/_is-arr-empty.d.ts +23 -0
- package/src/lib/guards/lib/_is-arr-empty.js +25 -0
- package/src/lib/guards/lib/_is-arr-empty.js.map +1 -0
- package/src/lib/guards/lib/_is-arr-of-arr.d.ts +25 -0
- package/src/lib/guards/lib/_is-arr-of-arr.js +31 -0
- package/src/lib/guards/lib/_is-arr-of-arr.js.map +1 -0
- package/src/lib/guards/lib/_is-arr.d.ts +21 -0
- package/src/lib/guards/lib/_is-arr.js +23 -0
- package/src/lib/guards/lib/_is-arr.js.map +1 -0
- package/src/lib/guards/lib/_is-big.d.ts +25 -0
- package/src/lib/guards/lib/_is-big.js +27 -0
- package/src/lib/guards/lib/_is-big.js.map +1 -0
- package/src/lib/guards/lib/_is-bool.d.ts +25 -0
- package/src/lib/guards/lib/_is-bool.js +27 -0
- package/src/lib/guards/lib/_is-bool.js.map +1 -0
- package/src/lib/guards/lib/_is-buff.d.ts +25 -0
- package/src/lib/guards/lib/_is-buff.js +29 -0
- package/src/lib/guards/lib/_is-buff.js.map +1 -0
- package/src/lib/guards/lib/_is-ctor.d.ts +25 -0
- package/src/lib/guards/lib/_is-ctor.js +30 -0
- package/src/lib/guards/lib/_is-ctor.js.map +1 -0
- package/src/lib/guards/lib/_is-empty-str-or-arr.d.ts +25 -0
- package/src/lib/guards/lib/_is-empty-str-or-arr.js +29 -0
- package/src/lib/guards/lib/_is-empty-str-or-arr.js.map +1 -0
- package/src/lib/guards/lib/_is-equality-same-type.d.ts +25 -0
- package/src/lib/guards/lib/_is-equality-same-type.js +33 -0
- package/src/lib/guards/lib/_is-equality-same-type.js.map +1 -0
- package/src/lib/guards/lib/_is-fn-t.d.ts +25 -0
- package/src/lib/guards/lib/_is-fn-t.js +27 -0
- package/src/lib/guards/lib/_is-fn-t.js.map +1 -0
- package/src/lib/guards/lib/_is-length-of.d.ts +47 -0
- package/src/lib/guards/lib/_is-length-of.js +49 -0
- package/src/lib/guards/lib/_is-length-of.js.map +1 -0
- package/src/lib/guards/lib/_is-length.d.ts +25 -0
- package/src/lib/guards/lib/_is-length.js +34 -0
- package/src/lib/guards/lib/_is-length.js.map +1 -0
- package/src/lib/guards/lib/_is-null.d.ts +25 -0
- package/src/lib/guards/lib/_is-null.js +27 -0
- package/src/lib/guards/lib/_is-null.js.map +1 -0
- package/src/lib/guards/lib/_is-num-neg.d.ts +25 -0
- package/src/lib/guards/lib/_is-num-neg.js +28 -0
- package/src/lib/guards/lib/_is-num-neg.js.map +1 -0
- package/src/lib/guards/lib/_is-num-pos.d.ts +25 -0
- package/src/lib/guards/lib/_is-num-pos.js +28 -0
- package/src/lib/guards/lib/_is-num-pos.js.map +1 -0
- package/src/lib/guards/lib/_is-num-t.d.ts +25 -0
- package/src/lib/guards/lib/_is-num-t.js +27 -0
- package/src/lib/guards/lib/_is-num-t.js.map +1 -0
- package/src/lib/guards/lib/_is-num-zero.d.ts +25 -0
- package/src/lib/guards/lib/_is-num-zero.js +28 -0
- package/src/lib/guards/lib/_is-num-zero.js.map +1 -0
- package/src/lib/guards/lib/_is-num.d.ts +26 -0
- package/src/lib/guards/lib/_is-num.js +29 -0
- package/src/lib/guards/lib/_is-num.js.map +1 -0
- package/src/lib/guards/lib/_is-obj-t.d.ts +26 -0
- package/src/lib/guards/lib/_is-obj-t.js +28 -0
- package/src/lib/guards/lib/_is-obj-t.js.map +1 -0
- package/src/lib/guards/lib/_is-obj.d.ts +27 -0
- package/src/lib/guards/lib/_is-obj.js +32 -0
- package/src/lib/guards/lib/_is-obj.js.map +1 -0
- package/src/lib/guards/lib/_is-prim.d.ts +27 -0
- package/src/lib/guards/lib/_is-prim.js +35 -0
- package/src/lib/guards/lib/_is-prim.js.map +1 -0
- package/src/lib/guards/lib/_is-promise-like.d.ts +24 -0
- package/src/lib/guards/lib/_is-promise-like.js +28 -0
- package/src/lib/guards/lib/_is-promise-like.js.map +1 -0
- package/src/lib/guards/lib/_is-str-empty.d.ts +25 -0
- package/src/lib/guards/lib/_is-str-empty.js +28 -0
- package/src/lib/guards/lib/_is-str-empty.js.map +1 -0
- package/src/lib/guards/lib/_is-str-t.d.ts +26 -0
- package/src/lib/guards/lib/_is-str-t.js +28 -0
- package/src/lib/guards/lib/_is-str-t.js.map +1 -0
- package/src/lib/guards/lib/_is-sym-t.d.ts +25 -0
- package/src/lib/guards/lib/_is-sym-t.js +27 -0
- package/src/lib/guards/lib/_is-sym-t.js.map +1 -0
- package/src/lib/guards/lib/_is-und-or-null.d.ts +25 -0
- package/src/lib/guards/lib/_is-und-or-null.js +29 -0
- package/src/lib/guards/lib/_is-und-or-null.js.map +1 -0
- package/src/lib/guards/lib/_is-und-t.d.ts +25 -0
- package/src/lib/guards/lib/_is-und-t.js +27 -0
- package/src/lib/guards/lib/_is-und-t.js.map +1 -0
- package/src/lib/interop-default.d.ts +18 -0
- package/src/lib/interop-default.js +21 -0
- package/src/lib/interop-default.js.map +1 -0
- package/src/lib/length.d.ts +22 -0
- package/src/lib/length.js +28 -0
- package/src/lib/length.js.map +1 -0
- package/src/lib/linear-regex.d.ts +136 -0
- package/src/lib/linear-regex.js +1140 -0
- package/src/lib/linear-regex.js.map +1 -0
- package/src/lib/no-side-effects.d.ts +29 -0
- package/src/lib/no-side-effects.js +33 -0
- package/src/lib/no-side-effects.js.map +1 -0
- package/src/lib/noop.d.ts +21 -0
- package/src/lib/noop.js +22 -0
- package/src/lib/noop.js.map +1 -0
- package/src/lib/normalized.d.ts +164 -0
- package/src/lib/normalized.js +232 -0
- package/src/lib/normalized.js.map +1 -0
- package/src/lib/number/number-from-hexadecimal.d.ts +24 -0
- package/src/lib/number/number-from-hexadecimal.js +29 -0
- package/src/lib/number/number-from-hexadecimal.js.map +1 -0
- package/src/lib/number/number-to-hexadecimal.d.ts +22 -0
- package/src/lib/number/number-to-hexadecimal.js +24 -0
- package/src/lib/number/number-to-hexadecimal.js.map +1 -0
- package/src/lib/number/to-num.d.ts +41 -0
- package/src/lib/number/to-num.js +41 -0
- package/src/lib/number/to-num.js.map +1 -0
- package/src/lib/numeronym.d.ts +41 -0
- package/src/lib/numeronym.js +54 -0
- package/src/lib/numeronym.js.map +1 -0
- package/src/lib/object/object-clone-deep.d.ts +21 -0
- package/src/lib/object/object-clone-deep.js +24 -0
- package/src/lib/object/object-clone-deep.js.map +1 -0
- package/src/lib/object/object-clone.d.ts +21 -0
- package/src/lib/object/object-clone.js +24 -0
- package/src/lib/object/object-clone.js.map +1 -0
- package/src/lib/object/object-delete-property.d.ts +28 -0
- package/src/lib/object/object-delete-property.js +32 -0
- package/src/lib/object/object-delete-property.js.map +1 -0
- package/src/lib/object/object-get-deep-property.d.ts +35 -0
- package/src/lib/object/object-get-deep-property.js +40 -0
- package/src/lib/object/object-get-deep-property.js.map +1 -0
- package/src/lib/object/object-get-keys-and-symbol-properties.d.ts +23 -0
- package/src/lib/object/object-get-keys-and-symbol-properties.js +30 -0
- package/src/lib/object/object-get-keys-and-symbol-properties.js.map +1 -0
- package/src/lib/object/object-remap.d.ts +33 -0
- package/src/lib/object/object-remap.js +36 -0
- package/src/lib/object/object-remap.js.map +1 -0
- package/src/lib/object/object-safe.d.ts +27 -0
- package/src/lib/object/object-safe.js +30 -0
- package/src/lib/object/object-safe.js.map +1 -0
- package/src/lib/object/object-set-deep-property.d.ts +35 -0
- package/src/lib/object/object-set-deep-property.js +44 -0
- package/src/lib/object/object-set-deep-property.js.map +1 -0
- package/src/lib/object/object-update.d.ts +28 -0
- package/src/lib/object/object-update.js +32 -0
- package/src/lib/object/object-update.js.map +1 -0
- package/src/lib/operator/compare.d.ts +26 -0
- package/src/lib/operator/compare.js +42 -0
- package/src/lib/operator/compare.js.map +1 -0
- package/src/lib/operator/definitions.d.ts +184 -0
- package/src/lib/operator/definitions.js +110 -0
- package/src/lib/operator/definitions.js.map +1 -0
- package/src/lib/operator/index.d.ts +19 -0
- package/src/lib/operator/index.js +20 -0
- package/src/lib/operator/index.js.map +1 -0
- package/src/lib/operator/inference.d.ts +66 -0
- package/src/lib/operator/inference.js +60 -0
- package/src/lib/operator/inference.js.map +1 -0
- package/src/lib/secret-box.d.ts +152 -0
- package/src/lib/secret-box.js +263 -0
- package/src/lib/secret-box.js.map +1 -0
- package/src/lib/serialize/base64-isomorphic-decode.d.ts +23 -0
- package/src/lib/serialize/base64-isomorphic-decode.js +28 -0
- package/src/lib/serialize/base64-isomorphic-decode.js.map +1 -0
- package/src/lib/serialize/base64-isomorphic-encode.d.ts +23 -0
- package/src/lib/serialize/base64-isomorphic-encode.js +28 -0
- package/src/lib/serialize/base64-isomorphic-encode.js.map +1 -0
- package/src/lib/serialize/json-deserialize.d.ts +25 -0
- package/src/lib/serialize/json-deserialize.js +27 -0
- package/src/lib/serialize/json-deserialize.js.map +1 -0
- package/src/lib/serialize/json-serialize.d.ts +25 -0
- package/src/lib/serialize/json-serialize.js +27 -0
- package/src/lib/serialize/json-serialize.js.map +1 -0
- package/src/lib/serialize/php-serial-deserialize-from-byte-stream.d.ts +77 -0
- package/src/lib/serialize/php-serial-deserialize-from-byte-stream.js +77 -0
- package/src/lib/serialize/php-serial-deserialize-from-byte-stream.js.map +1 -0
- package/src/lib/serialize/php-serial-is-serialized-byte-stream.d.ts +77 -0
- package/src/lib/serialize/php-serial-is-serialized-byte-stream.js +77 -0
- package/src/lib/serialize/php-serial-is-serialized-byte-stream.js.map +1 -0
- package/src/lib/serialize/php-serial-serialize-to-byte-stream.d.ts +77 -0
- package/src/lib/serialize/php-serial-serialize-to-byte-stream.js +77 -0
- package/src/lib/serialize/php-serial-serialize-to-byte-stream.js.map +1 -0
- package/src/lib/split-display-name.d.ts +36 -0
- package/src/lib/split-display-name.js +47 -0
- package/src/lib/split-display-name.js.map +1 -0
- package/src/lib/str.d.ts +21 -0
- package/src/lib/str.js +23 -0
- package/src/lib/str.js.map +1 -0
- package/src/lib/trim.d.ts +25 -0
- package/src/lib/trim.js +28 -0
- package/src/lib/trim.js.map +1 -0
- package/src/lib/truthy.d.ts +23 -0
- package/src/lib/truthy.js +30 -0
- package/src/lib/truthy.js.map +1 -0
|
@@ -0,0 +1,232 @@
|
|
|
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
|
+
*/ // eslint-disable-next-line @nx/enforce-module-boundaries
|
|
17
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
18
|
+
import { arrayMoveAtIndex } from "./array/array-move-at-index.js";
|
|
19
|
+
import { arrayRemoveItem } from "./array/array-remove-item.js";
|
|
20
|
+
import { _isNum, _isObj } from "./guards/index.js";
|
|
21
|
+
import { objectDeleteProperty } from "./object/object-delete-property.js";
|
|
22
|
+
/**
|
|
23
|
+
* Normalized data for 3NF
|
|
24
|
+
*
|
|
25
|
+
* @export
|
|
26
|
+
* @abstract
|
|
27
|
+
* @class Normalized
|
|
28
|
+
* @extends {NormalizedData<T, K>}
|
|
29
|
+
* @template T
|
|
30
|
+
* @template K
|
|
31
|
+
* @see https://en.wikipedia.org/wiki/Third_normal_form
|
|
32
|
+
*/ export class Normalized {
|
|
33
|
+
static build() {
|
|
34
|
+
return {
|
|
35
|
+
ids: [],
|
|
36
|
+
byId: {}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
get length() {
|
|
40
|
+
var _this_ids;
|
|
41
|
+
return ((_this_ids = this.ids) != null ? _this_ids : []).length;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Maps the ids/keys to their respective values in byId
|
|
45
|
+
*
|
|
46
|
+
* @static
|
|
47
|
+
* @template T
|
|
48
|
+
* @template V
|
|
49
|
+
* @param {T} v
|
|
50
|
+
* @returns {V[]}
|
|
51
|
+
* @memberof Normalized
|
|
52
|
+
*/ static toArray(v) {
|
|
53
|
+
return Array.from(v.ids).map((id)=>v.byId[id]);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Resets the keys/ids and values/byId back to empty
|
|
57
|
+
*
|
|
58
|
+
* @static
|
|
59
|
+
* @param {NormalizedData} v
|
|
60
|
+
* @returns {NormalizedData}
|
|
61
|
+
* @memberof Normalized
|
|
62
|
+
*/ static clear(v) {
|
|
63
|
+
v.ids = [];
|
|
64
|
+
v.byId = {};
|
|
65
|
+
return v;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Clears all values
|
|
69
|
+
* @returns {this}
|
|
70
|
+
* @memberof Normalized
|
|
71
|
+
*/ clear() {
|
|
72
|
+
return Normalized.clear(this);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create a new class instance from the provided params
|
|
76
|
+
*
|
|
77
|
+
* @static
|
|
78
|
+
* @template T
|
|
79
|
+
* @template K
|
|
80
|
+
* @param {(...T[] | [id: K, value: any][])} items
|
|
81
|
+
* @returns {NormalizedModel<T>}
|
|
82
|
+
* @memberof Normalized
|
|
83
|
+
*/ static from(...items) {
|
|
84
|
+
const _items = [
|
|
85
|
+
...items
|
|
86
|
+
].map((i)=>_isObj(i) ? [
|
|
87
|
+
i['id'],
|
|
88
|
+
i
|
|
89
|
+
] : [
|
|
90
|
+
...i
|
|
91
|
+
]);
|
|
92
|
+
const parsed = _items.reduce((acc, [id, v])=>{
|
|
93
|
+
var _ref;
|
|
94
|
+
return {
|
|
95
|
+
ids: ((_ref = acc == null ? void 0 : acc.ids) != null ? _ref : []).concat(id),
|
|
96
|
+
byId: _extends({}, acc == null ? void 0 : acc.byId, {
|
|
97
|
+
[id]: v
|
|
98
|
+
})
|
|
99
|
+
};
|
|
100
|
+
}, {
|
|
101
|
+
ids: [],
|
|
102
|
+
byId: {}
|
|
103
|
+
});
|
|
104
|
+
return new this(parsed);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Removes an item from an existing key value data structure object
|
|
108
|
+
*
|
|
109
|
+
* @static
|
|
110
|
+
* @template T
|
|
111
|
+
* @param {ID} id
|
|
112
|
+
* @param {NormalizedData<T>} model
|
|
113
|
+
* @returns {NormalizedData<T>}
|
|
114
|
+
* @memberof Normalized
|
|
115
|
+
*/ static remove(id, model) {
|
|
116
|
+
model.ids = arrayRemoveItem(model.ids, id);
|
|
117
|
+
model.byId = objectDeleteProperty(model.byId, id);
|
|
118
|
+
return model;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Sets an item in an existing denormalized key value object.
|
|
122
|
+
*
|
|
123
|
+
* @static
|
|
124
|
+
* @template T
|
|
125
|
+
* @template V
|
|
126
|
+
* @template K
|
|
127
|
+
* @param {[id: K, value: V]} item
|
|
128
|
+
* @param {T} model
|
|
129
|
+
* @param {number} [index]
|
|
130
|
+
* @returns {T}
|
|
131
|
+
* @memberof Normalized
|
|
132
|
+
*/ static set(item, model, index) {
|
|
133
|
+
const [id, value] = item;
|
|
134
|
+
const currentIndex = model.ids.indexOf(id);
|
|
135
|
+
const isUpdate = currentIndex !== -1;
|
|
136
|
+
model.byId[id] = value;
|
|
137
|
+
if (!isUpdate) {
|
|
138
|
+
model.ids.push(id);
|
|
139
|
+
} else if (_isNum(index) && currentIndex !== index) {
|
|
140
|
+
model.ids = arrayMoveAtIndex(model.ids, currentIndex, index);
|
|
141
|
+
}
|
|
142
|
+
return model;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get a property from the key value. shortens call such as model.byId[foo]
|
|
146
|
+
*
|
|
147
|
+
* @static
|
|
148
|
+
* @template T
|
|
149
|
+
* @param {ID} id
|
|
150
|
+
* @param {NormalizedData<T>} model
|
|
151
|
+
* @returns {(undefined | T)}
|
|
152
|
+
* @memberof Normalized
|
|
153
|
+
*/ static get(id, model) {
|
|
154
|
+
var _model_byId_id;
|
|
155
|
+
return (_model_byId_id = model.byId[id]) != null ? _model_byId_id : null;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The properties to keep when object is passed to JSON.stringify(...)
|
|
159
|
+
* @returns {NormalizedData<T, K>}
|
|
160
|
+
* @memberof Normalized
|
|
161
|
+
*/ toJSON() {
|
|
162
|
+
return {
|
|
163
|
+
ids: this.ids,
|
|
164
|
+
byId: this.byId
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Converts the current values into an array ordered by the
|
|
169
|
+
* appearance of the key in ids array
|
|
170
|
+
* @returns {Array<T>}
|
|
171
|
+
* @memberof Normalized
|
|
172
|
+
*/ toArray() {
|
|
173
|
+
return Normalized.toArray(this);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Aliases the static method to shortcut delete operations on this instance
|
|
177
|
+
*
|
|
178
|
+
* @param {K} id
|
|
179
|
+
* @returns {this}
|
|
180
|
+
* @memberof Normalized
|
|
181
|
+
*/ remove(id) {
|
|
182
|
+
Normalized.remove(id, this);
|
|
183
|
+
return this;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Returns whether or not the model byId has property key/id
|
|
187
|
+
*
|
|
188
|
+
* @param {ID} id
|
|
189
|
+
* @returns {boolean}
|
|
190
|
+
* @memberof Normalized
|
|
191
|
+
*/ has(id) {
|
|
192
|
+
return this.hasOwnProperty.call(this.byId, id);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Aliases the static method to shortcut set operations on this instance
|
|
196
|
+
*
|
|
197
|
+
* @param {ID} id
|
|
198
|
+
* @param {*} [value]
|
|
199
|
+
* @param {number} [index]
|
|
200
|
+
* @returns {this}
|
|
201
|
+
* @memberof Normalized
|
|
202
|
+
*/ set(id, value, index) {
|
|
203
|
+
return Normalized.set([
|
|
204
|
+
id,
|
|
205
|
+
value
|
|
206
|
+
], this, index);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Shortcuts getting the value of properties of the current instance
|
|
210
|
+
*
|
|
211
|
+
* @param {ID} id
|
|
212
|
+
* @returns {(undefined | T)}
|
|
213
|
+
* @memberof Normalized
|
|
214
|
+
*/ get(id) {
|
|
215
|
+
return Normalized.get(id, this);
|
|
216
|
+
}
|
|
217
|
+
/** @ignore */ get hasOwnProperty() {
|
|
218
|
+
return Object.prototype.hasOwnProperty;
|
|
219
|
+
}
|
|
220
|
+
constructor(props){
|
|
221
|
+
this.props = props;
|
|
222
|
+
this.ids = [];
|
|
223
|
+
this.byId = {};
|
|
224
|
+
const { ids, byId } = _extends({}, props);
|
|
225
|
+
this.ids = [
|
|
226
|
+
...ids != null ? ids : []
|
|
227
|
+
];
|
|
228
|
+
this.byId = _extends({}, byId);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
//# sourceMappingURL=normalized.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/shared/util/tools/src/lib/normalized.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// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { NormalizedData, NormalizedModel } from '@aglyn/shared-data-types'\nimport { arrayMoveAtIndex } from './array/array-move-at-index'\nimport { arrayRemoveItem } from './array/array-remove-item'\nimport { _isNum, _isObj } from './guards'\nimport { objectDeleteProperty } from './object/object-delete-property'\n\n\ntype ID = string\n\n/**\n * Normalized data for 3NF\n *\n * @export\n * @abstract\n * @class Normalized\n * @extends {NormalizedData<T, K>}\n * @template T\n * @template K\n * @see https://en.wikipedia.org/wiki/Third_normal_form\n */\nexport class Normalized<T = any, K extends ID = ID>\n implements NormalizedModel<T, K>\n{\n static build<T, K extends ID>(): NormalizedData<T, K> {\n return { ids: [], byId: {} }\n }\n\n public ids: K[] = []\n public byId: { [P in K]?: T } = {}\n\n public get length(): number {\n return (this.ids ?? []).length\n }\n\n constructor(public readonly props?: NormalizedData<T, K>) {\n const { ids, byId } = { ...props }\n this.ids = [...(ids ?? [])]\n this.byId = { ...byId }\n }\n\n /**\n * Maps the ids/keys to their respective values in byId\n *\n * @static\n * @template T\n * @template V\n * @param {T} v\n * @returns {V[]}\n * @memberof Normalized\n */\n public static toArray<T extends NormalizedData<V>, V>(v: T): V[] {\n return Array.from(v.ids).map((id) => v.byId[id])\n }\n\n /**\n * Resets the keys/ids and values/byId back to empty\n *\n * @static\n * @param {NormalizedData} v\n * @returns {NormalizedData}\n * @memberof Normalized\n */\n public static clear<T extends NormalizedData<any>>(v: T): T {\n v.ids = []\n v.byId = {}\n return v\n }\n\n /**\n * Clears all values\n * @returns {this}\n * @memberof Normalized\n */\n public clear(): this {\n return Normalized.clear(this)\n }\n\n /**\n * Create a new class instance from the provided params\n *\n * @static\n * @template T\n * @template K\n * @param {(...T[] | [id: K, value: any][])} items\n * @returns {NormalizedModel<T>}\n * @memberof Normalized\n */\n public static from<T extends { id: ID }, K extends ID>(\n ...items: T[] | [id: K, value: any][]\n ): NormalizedModel<T> {\n const _items = [...items].map((i) => (_isObj(i) ? [i['id'], i] : [...i]))\n const parsed = _items.reduce<NormalizedData<T, K>>(\n (acc, [id, v]) => ({\n ids: (acc?.ids ?? []).concat(id),\n byId: { ...acc?.byId, [id]: v },\n }),\n { ids: [], byId: {} },\n )\n return new this(parsed)\n }\n\n /**\n * Removes an item from an existing key value data structure object\n *\n * @static\n * @template T\n * @param {ID} id\n * @param {NormalizedData<T>} model\n * @returns {NormalizedData<T>}\n * @memberof Normalized\n */\n public static remove<\n T extends NormalizedData<TT, any>,\n K extends ID,\n TT = any,\n >(id: K, model: T): NormalizedData<TT, ID> {\n model.ids = arrayRemoveItem(model.ids, id)\n model.byId = objectDeleteProperty(model.byId, id)\n return model\n }\n\n /**\n * Sets an item in an existing denormalized key value object.\n *\n * @static\n * @template T\n * @template V\n * @template K\n * @param {[id: K, value: V]} item\n * @param {T} model\n * @param {number} [index]\n * @returns {T}\n * @memberof Normalized\n */\n public static set<T extends NormalizedData<V, K>, V, K extends ID>(\n item: [id: K, value: V],\n model: T,\n index?: number,\n ): T {\n const [id, value] = item\n const currentIndex = model.ids.indexOf(id)\n const isUpdate = currentIndex !== -1\n\n model.byId[id] = value\n\n if (!isUpdate) {\n model.ids.push(id)\n } else if (_isNum(index) && currentIndex !== index) {\n model.ids = arrayMoveAtIndex(model.ids, currentIndex, index)\n }\n\n return model\n }\n\n /**\n * Get a property from the key value. shortens call such as model.byId[foo]\n *\n * @static\n * @template T\n * @param {ID} id\n * @param {NormalizedData<T>} model\n * @returns {(undefined | T)}\n * @memberof Normalized\n */\n public static get<T extends NormalizedData<V, K>, K extends ID, V>(\n id: K,\n model: T,\n ): V | null {\n return model.byId[id] ?? null\n }\n\n /**\n * The properties to keep when object is passed to JSON.stringify(...)\n * @returns {NormalizedData<T, K>}\n * @memberof Normalized\n */\n public toJSON(): NormalizedData<T, K> {\n return { ids: this.ids, byId: this.byId }\n }\n\n /**\n * Converts the current values into an array ordered by the\n * appearance of the key in ids array\n * @returns {Array<T>}\n * @memberof Normalized\n */\n public toArray(): Array<T> {\n return Normalized.toArray(this)\n }\n\n /**\n * Aliases the static method to shortcut delete operations on this instance\n *\n * @param {K} id\n * @returns {this}\n * @memberof Normalized\n */\n public remove(id: K): this {\n Normalized.remove(id, this)\n return this\n }\n\n /**\n * Returns whether or not the model byId has property key/id\n *\n * @param {ID} id\n * @returns {boolean}\n * @memberof Normalized\n */\n public has(id: ID): boolean {\n return this.hasOwnProperty.call(this.byId, id)\n }\n\n /**\n * Aliases the static method to shortcut set operations on this instance\n *\n * @param {ID} id\n * @param {*} [value]\n * @param {number} [index]\n * @returns {this}\n * @memberof Normalized\n */\n public set(id: ID, value?: T, index?: number): this {\n return Normalized.set([id, value], this, index)\n }\n\n /**\n * Shortcuts getting the value of properties of the current instance\n *\n * @param {ID} id\n * @returns {(undefined | T)}\n * @memberof Normalized\n */\n public get(id: ID): undefined | T {\n return Normalized.get(id, this)\n }\n\n /** @ignore */\n private get hasOwnProperty() {\n return Object.prototype.hasOwnProperty\n }\n}\n"],"names":["arrayMoveAtIndex","arrayRemoveItem","_isNum","_isObj","objectDeleteProperty","Normalized","build","ids","byId","length","toArray","v","Array","from","map","id","clear","items","_items","i","parsed","reduce","acc","concat","remove","model","set","item","index","value","currentIndex","indexOf","isUpdate","push","get","toJSON","has","hasOwnProperty","call","Object","prototype","props"],"mappings":"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"}
|
|
@@ -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
|
+
* Convert Base16/Hexadecimal string to its decimal/number equivalent
|
|
19
|
+
*
|
|
20
|
+
* @param hex - 8-bit hexadecimal string
|
|
21
|
+
* @returns the hexadecimal as a number
|
|
22
|
+
*/
|
|
23
|
+
export declare function numberFromHexadecimal(hex: string): number;
|
|
24
|
+
export default numberFromHexadecimal;
|
|
@@ -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
|
+
*/ import { toNum } from "./to-num.js";
|
|
17
|
+
/**
|
|
18
|
+
* Convert Base16/Hexadecimal string to its decimal/number equivalent
|
|
19
|
+
*
|
|
20
|
+
* @param hex - 8-bit hexadecimal string
|
|
21
|
+
* @returns the hexadecimal as a number
|
|
22
|
+
*/ export function numberFromHexadecimal(hex) {
|
|
23
|
+
return toNum(hex, {
|
|
24
|
+
radix: 16
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export default numberFromHexadecimal;
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=number-from-hexadecimal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/number/number-from-hexadecimal.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 {toNum} from './to-num'\n\n\n/**\n * Convert Base16/Hexadecimal string to its decimal/number equivalent\n *\n * @param hex - 8-bit hexadecimal string\n * @returns the hexadecimal as a number\n */\nexport function numberFromHexadecimal(hex: string): number {\n return toNum(hex, {radix: 16})\n}\nexport default numberFromHexadecimal\n"],"names":["toNum","numberFromHexadecimal","hex","radix"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAAQA,KAAK,QAAO,cAAU;AAG9B;;;;;CAKC,GACD,OAAO,SAASC,sBAAsBC,GAAW;IAC/C,OAAOF,MAAME,KAAK;QAACC,OAAO;IAAE;AAC9B;AACA,eAAeF,sBAAqB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
* Convert any value to 8-bit hexadecimal string
|
|
19
|
+
* @param val - value to convert
|
|
20
|
+
*/
|
|
21
|
+
export declare function numberToHexadecimal<T>(val: T): string;
|
|
22
|
+
export default numberToHexadecimal;
|
|
@@ -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
|
+
* Convert any value to 8-bit hexadecimal string
|
|
18
|
+
* @param val - value to convert
|
|
19
|
+
*/ export function numberToHexadecimal(val) {
|
|
20
|
+
return Number(val).toString(16);
|
|
21
|
+
}
|
|
22
|
+
export default numberToHexadecimal;
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=number-to-hexadecimal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/number/number-to-hexadecimal.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 * Convert any value to 8-bit hexadecimal string\n * @param val - value to convert\n */\nexport function numberToHexadecimal<T>(val: T): string {\n return Number(val).toString(16)\n}\nexport default numberToHexadecimal\n"],"names":["numberToHexadecimal","val","Number","toString"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;CAGC,GACD,OAAO,SAASA,oBAAuBC,GAAM;IAC3C,OAAOC,OAAOD,KAAKE,QAAQ,CAAC;AAC9B;AACA,eAAeH,oBAAmB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 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
|
+
type ToNumType = 'int' | 'float' | 'eval';
|
|
18
|
+
type ToNumResult<T extends ToNumType = never> = ConditionalNonDist<T, 'eval', any, number>;
|
|
19
|
+
export type ToNumOptions<T extends ToNumType = never, N = 0> = {
|
|
20
|
+
onNaN?: N;
|
|
21
|
+
type?: 'int';
|
|
22
|
+
radix?: number;
|
|
23
|
+
} | {
|
|
24
|
+
onNaN?: N;
|
|
25
|
+
type?: T;
|
|
26
|
+
radix?: never;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Ensure and parse any value to a number.
|
|
30
|
+
*
|
|
31
|
+
* - If radix, `{type: 'int'}` is provided will use {@link parseInt}
|
|
32
|
+
* - If `{type: 'parse'}` is provided will use {@link parseFloat}
|
|
33
|
+
* - If `{type: 'eval'}` is provided will use {@link eval} and {@link Number}
|
|
34
|
+
* - Otherwise uses {@link Number|Number(val)}
|
|
35
|
+
* - If parsing results in NaN will return {@link onNaN}.
|
|
36
|
+
*
|
|
37
|
+
* @param val - the value to parse into a number
|
|
38
|
+
* @param options - override default parsing behavior
|
|
39
|
+
*/
|
|
40
|
+
export declare function toNum<T extends ToNumType, N = 0>(val: string | any, options?: ToNumOptions<T, N>): ToNumResult<T> | N;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2023 Aglyn LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/ import { _isNumT } from "../guards/lib/_is-num-t.js";
|
|
18
|
+
/**
|
|
19
|
+
* Ensure and parse any value to a number.
|
|
20
|
+
*
|
|
21
|
+
* - If radix, `{type: 'int'}` is provided will use {@link parseInt}
|
|
22
|
+
* - If `{type: 'parse'}` is provided will use {@link parseFloat}
|
|
23
|
+
* - If `{type: 'eval'}` is provided will use {@link eval} and {@link Number}
|
|
24
|
+
* - Otherwise uses {@link Number|Number(val)}
|
|
25
|
+
* - If parsing results in NaN will return {@link onNaN}.
|
|
26
|
+
*
|
|
27
|
+
* @param val - the value to parse into a number
|
|
28
|
+
* @param options - override default parsing behavior
|
|
29
|
+
*/ export function toNum(val, options) {
|
|
30
|
+
const { type, onNaN, radix } = _extends({}, options);
|
|
31
|
+
let parsed = NaN;
|
|
32
|
+
if (_isNumT(radix)) parsed = parseInt(val, radix);
|
|
33
|
+
else if (type === 'int') parsed = parseInt(val);
|
|
34
|
+
else if (type === 'float') parsed = parseFloat(val);
|
|
35
|
+
else if (type === 'eval') parsed = Number(eval(val));
|
|
36
|
+
else if (!type) parsed = Number(val);
|
|
37
|
+
if (isNaN(parsed)) parsed = onNaN != null ? onNaN : 0;
|
|
38
|
+
return parsed;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=to-num.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/number/to-num.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 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 { _isNumT } from '../guards/lib/_is-num-t'\n\ntype ToNumType = 'int' | 'float' | 'eval'\ntype ToNumResult<T extends ToNumType = never> = ConditionalNonDist<\n T,\n 'eval',\n any,\n number\n>\n\nexport type ToNumOptions<T extends ToNumType = never, N = 0> =\n | { onNaN?: N; type?: 'int'; radix?: number }\n | { onNaN?: N; type?: T; radix?: never }\n\n/**\n * Ensure and parse any value to a number.\n *\n * - If radix, `{type: 'int'}` is provided will use {@link parseInt}\n * - If `{type: 'parse'}` is provided will use {@link parseFloat}\n * - If `{type: 'eval'}` is provided will use {@link eval} and {@link Number}\n * - Otherwise uses {@link Number|Number(val)}\n * - If parsing results in NaN will return {@link onNaN}.\n *\n * @param val - the value to parse into a number\n * @param options - override default parsing behavior\n */\nexport function toNum<T extends ToNumType, N = 0>(\n val: string | any,\n options?: ToNumOptions<T, N>,\n): ToNumResult<T> | N {\n const { type, onNaN, radix } = { ...options }\n let parsed: ToNumResult<T> | N = NaN\n\n if (_isNumT(radix)) parsed = parseInt(val, radix)\n else if (type === 'int') parsed = parseInt(val)\n else if (type === 'float') parsed = parseFloat(val)\n else if (type === 'eval') parsed = Number(eval(val))\n else if (!type) parsed = Number(val)\n if (isNaN(parsed)) parsed = onNaN ?? 0\n\n return parsed\n}\n"],"names":["_isNumT","toNum","val","options","type","onNaN","radix","parsed","NaN","parseInt","parseFloat","Number","eval","isNaN"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,OAAO,QAAQ,6BAAyB;AAcjD;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,MACdC,GAAiB,EACjBC,OAA4B;IAE5B,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAG,aAAKH;IACpC,IAAII,SAA6BC;IAEjC,IAAIR,QAAQM,QAAQC,SAASE,SAASP,KAAKI;SACtC,IAAIF,SAAS,OAAOG,SAASE,SAASP;SACtC,IAAIE,SAAS,SAASG,SAASG,WAAWR;SAC1C,IAAIE,SAAS,QAAQG,SAASI,OAAOC,KAAKV;SAC1C,IAAI,CAACE,MAAMG,SAASI,OAAOT;IAChC,IAAIW,MAAMN,SAASA,SAASF,gBAAAA,QAAS;IAErC,OAAOE;AACT"}
|
|
@@ -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 NumeronymOpts = {
|
|
18
|
+
kind?: NumeronymKind;
|
|
19
|
+
short?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare enum NumeronymKind {
|
|
22
|
+
n19s = "NumericalContractions",
|
|
23
|
+
A9bs = "AlphanumericAbbreviationS",
|
|
24
|
+
A2S = "AlphanumericAcronymS"
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create a numeronym string from the provided string of characters
|
|
28
|
+
*
|
|
29
|
+
* e.g.
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const intl = 'Internationalization'
|
|
32
|
+
* numeronym(intl, {kind: NumeronymKind.n19s})
|
|
33
|
+
* // result: I18n
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @export
|
|
37
|
+
* @param {string} str
|
|
38
|
+
* @param {NumeronymOpts} [opt]
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
export declare function numeronym(str: string, opt?: NumeronymOpts): string;
|
|
@@ -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 var NumeronymKind = /*#__PURE__*/ function(NumeronymKind) {
|
|
17
|
+
NumeronymKind["n19s"] = "NumericalContractions"; /* first letter + len between(+ last letter) */
|
|
18
|
+
NumeronymKind["A9bs"] = "AlphanumericAbbreviationS"; /* AlphaN. = A9, Abbr. = bs */
|
|
19
|
+
NumeronymKind["A2S"] = "AlphanumericAcronymS"; /* (2) A's and (1) S (e.g. W3 or W3C) */
|
|
20
|
+
return NumeronymKind;
|
|
21
|
+
}({});
|
|
22
|
+
/**
|
|
23
|
+
* Create a numeronym string from the provided string of characters
|
|
24
|
+
*
|
|
25
|
+
* e.g.
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const intl = 'Internationalization'
|
|
28
|
+
* numeronym(intl, {kind: NumeronymKind.n19s})
|
|
29
|
+
* // result: I18n
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @export
|
|
33
|
+
* @param {string} str
|
|
34
|
+
* @param {NumeronymOpts} [opt]
|
|
35
|
+
* @returns
|
|
36
|
+
*/ export function numeronym(str, opt) {
|
|
37
|
+
const { kind, short } = opt != null ? opt : {};
|
|
38
|
+
const builder = {
|
|
39
|
+
["NumericalContractions"]: ()=>{
|
|
40
|
+
const v = String(str);
|
|
41
|
+
const ln = v.length;
|
|
42
|
+
if (ln < 2) {
|
|
43
|
+
return v;
|
|
44
|
+
}
|
|
45
|
+
if (ln < 3 || short) {
|
|
46
|
+
return `${v[0]}${ln - 1}`;
|
|
47
|
+
}
|
|
48
|
+
return `${v[0]}${ln - 2}${v[ln - 1]}`;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
return builder[kind != null ? kind : "NumericalContractions"]();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=numeronym.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/shared/util/tools/src/lib/numeronym.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\nexport type NumeronymOpts = {\n kind?: NumeronymKind\n short?: boolean\n}\n\nexport enum NumeronymKind {\n n19s = 'NumericalContractions' /* first letter + len between(+ last letter) */,\n A9bs = 'AlphanumericAbbreviationS' /* AlphaN. = A9, Abbr. = bs */,\n A2S = 'AlphanumericAcronymS' /* (2) A's and (1) S (e.g. W3 or W3C) */,\n}\n\n/**\n * Create a numeronym string from the provided string of characters\n *\n * e.g.\n * ```typescript\n * const intl = 'Internationalization'\n * numeronym(intl, {kind: NumeronymKind.n19s})\n * // result: I18n\n * ```\n *\n * @export\n * @param {string} str\n * @param {NumeronymOpts} [opt]\n * @returns\n */\nexport function numeronym(str: string, opt?: NumeronymOpts) {\n const {kind, short} = opt ?? {}\n const builder = {\n [NumeronymKind.n19s]: () => {\n const v = String(str)\n const ln = v.length\n if (ln < 2) {\n return v\n }\n if (ln < 3 || short) {\n return `${v[0]}${ln - 1}`\n }\n return `${v[0]}${ln - 2}${v[ln - 1]}`\n },\n }\n\n return (builder as Record<string, () => string>)[kind ?? NumeronymKind.n19s]()\n}\n"],"names":["NumeronymKind","numeronym","str","opt","kind","short","builder","v","String","ln","length"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GASD,OAAO,IAAA,AAAKA,uCAAAA;qDACqB,6CAA6C;yDACzC,4BAA4B;mDAClC,sCAAsC;WAHzDA;MAIX;AAED;;;;;;;;;;;;;;CAcC,GACD,OAAO,SAASC,UAAUC,GAAW,EAAEC,GAAmB;IACxD,MAAM,EAACC,IAAI,EAAEC,KAAK,EAAC,GAAGF,cAAAA,MAAO,CAAC;IAC9B,MAAMG,UAAU;QACd,yBAAoB,EAAE;YACpB,MAAMC,IAAIC,OAAON;YACjB,MAAMO,KAAKF,EAAEG,MAAM;YACnB,IAAID,KAAK,GAAG;gBACV,OAAOF;YACT;YACA,IAAIE,KAAK,KAAKJ,OAAO;gBACnB,OAAO,GAAGE,CAAC,CAAC,EAAE,GAAGE,KAAK,GAAG;YAC3B;YACA,OAAO,GAAGF,CAAC,CAAC,EAAE,GAAGE,KAAK,IAAIF,CAAC,CAACE,KAAK,EAAE,EAAE;QACvC;IACF;IAEA,OAAO,AAACH,OAAwC,CAACF,eAAAA,+BAA2B;AAC9E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
* Copy deep
|
|
19
|
+
*/
|
|
20
|
+
export declare function objectCloneDeep<K extends keyof any, T>(target: Record<K, T>): Record<K, T>;
|
|
21
|
+
export default objectCloneDeep;
|
|
@@ -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
|
+
*/ import cloneDeep from "../copy.js";
|
|
17
|
+
/**
|
|
18
|
+
* Copy deep
|
|
19
|
+
*/ export function objectCloneDeep(target) {
|
|
20
|
+
return cloneDeep(target);
|
|
21
|
+
}
|
|
22
|
+
export default objectCloneDeep;
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=object-clone-deep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/object/object-clone-deep.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 cloneDeep from '../copy'\n\n/**\n * Copy deep\n */\nexport function objectCloneDeep<K extends keyof any, T>(\n target: Record<K, T>,\n): Record<K, T> {\n return cloneDeep(target)\n}\nexport default objectCloneDeep\n"],"names":["cloneDeep","objectCloneDeep","target"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,OAAOA,eAAe,aAAS;AAE/B;;CAEC,GACD,OAAO,SAASC,gBACdC,MAAoB;IAEpB,OAAOF,UAAUE;AACnB;AACA,eAAeD,gBAAe"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
* Shallow copy iterable properties in iterable or array
|
|
19
|
+
*/
|
|
20
|
+
export declare function objectClone<T>(target: Record<keyof any, T>): Record<keyof any, T>;
|
|
21
|
+
export default objectClone;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2022 Aglyn LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/ /**
|
|
18
|
+
* Shallow copy iterable properties in iterable or array
|
|
19
|
+
*/ export function objectClone(target) {
|
|
20
|
+
return _extends({}, target);
|
|
21
|
+
}
|
|
22
|
+
export default objectClone;
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=object-clone.js.map
|