@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 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/object/object-clone.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 * Shallow copy iterable properties in iterable or array\n */\nexport function objectClone<T>(\n target: Record<keyof any, T>,\n): Record<keyof any, T> {\n return { ...target }\n}\n\nexport default objectClone\n"],"names":["objectClone","target"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;CAEC,GACD,OAAO,SAASA,YACdC,MAA4B;IAE5B,OAAO,aAAKA;AACd;AAEA,eAAeD,YAAW"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Removes a named property in an object.Modifies the existing object unless
|
|
19
|
+
* provided `{copy: true}` for options
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const alpha = `{ping: 'foo', pong: 'bar'}`
|
|
23
|
+
* const bravo = `objectDeleteProperty(alpha, 'ping') // {pong: 'bar'}`
|
|
24
|
+
*/
|
|
25
|
+
export declare function objectDeleteProperty<T, K extends keyof T>(obj: T, key: K, options?: {
|
|
26
|
+
copy: boolean;
|
|
27
|
+
}): Omit<T, K>;
|
|
28
|
+
export default objectDeleteProperty;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
* Removes a named property in an object.Modifies the existing object unless
|
|
19
|
+
* provided `{copy: true}` for options
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const alpha = `{ping: 'foo', pong: 'bar'}`
|
|
23
|
+
* const bravo = `objectDeleteProperty(alpha, 'ping') // {pong: 'bar'}`
|
|
24
|
+
*/ export function objectDeleteProperty(obj, key, options) {
|
|
25
|
+
const { copy } = _extends({}, options);
|
|
26
|
+
const res = copy ? _extends({}, obj) : obj;
|
|
27
|
+
delete res[key];
|
|
28
|
+
return res;
|
|
29
|
+
}
|
|
30
|
+
export default objectDeleteProperty;
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=object-delete-property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/object/object-delete-property.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Removes a named property in an object.Modifies the existing object unless\n * provided `{copy: true}` for options\n *\n * @example\n * const alpha = `{ping: 'foo', pong: 'bar'}`\n * const bravo = `objectDeleteProperty(alpha, 'ping') // {pong: 'bar'}`\n */\nexport function objectDeleteProperty<T, K extends keyof T>(\n obj: T,\n key: K,\n options?: { copy: boolean },\n): Omit<T, K> {\n const { copy } = { ...options }\n const res = copy ? { ...obj } : obj\n delete res[key]\n return res\n}\n\nexport default objectDeleteProperty\n"],"names":["objectDeleteProperty","obj","key","options","copy","res"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;CAOC,GACD,OAAO,SAASA,qBACdC,GAAM,EACNC,GAAM,EACNC,OAA2B;IAE3B,MAAM,EAAEC,IAAI,EAAE,GAAG,aAAKD;IACtB,MAAME,MAAMD,OAAO,aAAKH,OAAQA;IAChC,OAAOI,GAAG,CAACH,IAAI;IACf,OAAOG;AACT;AAEA,eAAeL,qBAAoB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
* Get a nested property within an object literal
|
|
19
|
+
*
|
|
20
|
+
* EXAMPLE:
|
|
21
|
+
* const obj = {'a': {'prop': {'that': 'exists'}}};
|
|
22
|
+
* getNestedProperty(obj, 'a.very.deep.prop', 'value')
|
|
23
|
+
*
|
|
24
|
+
* @see getProperty
|
|
25
|
+
* @see objectSetDeepProperty
|
|
26
|
+
*
|
|
27
|
+
* @export
|
|
28
|
+
* @template T
|
|
29
|
+
* @param {T} obj
|
|
30
|
+
* @param {string} path
|
|
31
|
+
* @param {string} [separator='.']
|
|
32
|
+
* @returns {*}
|
|
33
|
+
*/
|
|
34
|
+
export declare function objectGetDeepProperty<U, T = any>(obj: T, path: string, separator?: string): U;
|
|
35
|
+
export default objectGetDeepProperty;
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
* Get a nested property within an object literal
|
|
18
|
+
*
|
|
19
|
+
* EXAMPLE:
|
|
20
|
+
* const obj = {'a': {'prop': {'that': 'exists'}}};
|
|
21
|
+
* getNestedProperty(obj, 'a.very.deep.prop', 'value')
|
|
22
|
+
*
|
|
23
|
+
* @see getProperty
|
|
24
|
+
* @see objectSetDeepProperty
|
|
25
|
+
*
|
|
26
|
+
* @export
|
|
27
|
+
* @template T
|
|
28
|
+
* @param {T} obj
|
|
29
|
+
* @param {string} path
|
|
30
|
+
* @param {string} [separator='.']
|
|
31
|
+
* @returns {*}
|
|
32
|
+
*/ export function objectGetDeepProperty(obj, path, separator = '.') {
|
|
33
|
+
const keys = path.split(separator);
|
|
34
|
+
const lastKey = keys.pop();
|
|
35
|
+
const lastObj = keys.reduce((v, k)=>v == null ? void 0 : v[k], obj);
|
|
36
|
+
return lastObj == null ? void 0 : lastObj[lastKey];
|
|
37
|
+
}
|
|
38
|
+
export default objectGetDeepProperty;
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=object-get-deep-property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/object/object-get-deep-property.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Get a nested property within an object literal\n *\n * EXAMPLE:\n * const obj = {'a': {'prop': {'that': 'exists'}}};\n * getNestedProperty(obj, 'a.very.deep.prop', 'value')\n *\n * @see getProperty\n * @see objectSetDeepProperty\n *\n * @export\n * @template T\n * @param {T} obj\n * @param {string} path\n * @param {string} [separator='.']\n * @returns {*}\n */\nexport function objectGetDeepProperty<U, T = any>(\n obj: T,\n path: string,\n separator = '.',\n): U {\n const keys = path.split(separator)\n const lastKey = keys.pop()\n const lastObj = keys.reduce((v: any, k) => v?.[k], obj as any)\n return lastObj?.[lastKey]\n}\n\nexport default objectGetDeepProperty\n"],"names":["objectGetDeepProperty","obj","path","separator","keys","split","lastKey","pop","lastObj","reduce","v","k"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,SAASA,sBACdC,GAAM,EACNC,IAAY,EACZC,YAAY,GAAG;IAEf,MAAMC,OAAOF,KAAKG,KAAK,CAACF;IACxB,MAAMG,UAAUF,KAAKG,GAAG;IACxB,MAAMC,UAAUJ,KAAKK,MAAM,CAAC,CAACC,GAAQC,IAAMD,qBAAAA,CAAG,CAACC,EAAE,EAAEV;IACnD,OAAOO,2BAAAA,OAAS,CAACF,QAAQ;AAC3B;AAEA,eAAeN,sBAAqB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Retrieve all keys of source object and symbol properties found directly
|
|
19
|
+
* @param {T} obj
|
|
20
|
+
* @returns {K[]}
|
|
21
|
+
*/
|
|
22
|
+
export declare function objectGetKeysAndSymbolProperties<T, K extends keyof T>(obj: T): K[];
|
|
23
|
+
export default objectGetKeysAndSymbolProperties;
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
* Retrieve all keys of source object and symbol properties found directly
|
|
18
|
+
* @param {T} obj
|
|
19
|
+
* @returns {K[]}
|
|
20
|
+
*/ export function objectGetKeysAndSymbolProperties(obj) {
|
|
21
|
+
const keys = Object.keys(obj);
|
|
22
|
+
if (Object.getOwnPropertySymbols) {
|
|
23
|
+
const propertySymbols = Object.getOwnPropertySymbols(obj);
|
|
24
|
+
return keys.concat(propertySymbols);
|
|
25
|
+
}
|
|
26
|
+
return keys;
|
|
27
|
+
}
|
|
28
|
+
export default objectGetKeysAndSymbolProperties;
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=object-get-keys-and-symbol-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/object/object-get-keys-and-symbol-properties.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 * Retrieve all keys of source object and symbol properties found directly\n * @param {T} obj\n * @returns {K[]}\n */\nexport function objectGetKeysAndSymbolProperties<T, K extends keyof T>(\n obj: T,\n): K[] {\n const keys: K[] = Object.keys(obj) as K[]\n if (Object.getOwnPropertySymbols) {\n const propertySymbols = Object.getOwnPropertySymbols(obj)\n return keys.concat(propertySymbols as K[])\n }\n return keys\n}\n\nexport default objectGetKeysAndSymbolProperties\n"],"names":["objectGetKeysAndSymbolProperties","obj","keys","Object","getOwnPropertySymbols","propertySymbols","concat"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;CAIC,GACD,OAAO,SAASA,iCACdC,GAAM;IAEN,MAAMC,OAAYC,OAAOD,IAAI,CAACD;IAC9B,IAAIE,OAAOC,qBAAqB,EAAE;QAChC,MAAMC,kBAAkBF,OAAOC,qBAAqB,CAACH;QACrD,OAAOC,KAAKI,MAAM,CAACD;IACrB;IACA,OAAOH;AACT;AAEA,eAAeF,iCAAgC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
export type RemapOptions = {
|
|
18
|
+
/** When true will remove 'undefined' values */
|
|
19
|
+
remove?: boolean;
|
|
20
|
+
copy?: 'deep' | 'shallow' | boolean;
|
|
21
|
+
};
|
|
22
|
+
export type RemapTarget<K extends PKey, V = unknown> = Record<K, V>;
|
|
23
|
+
export type RemapCallback<K extends PKey, V, U = V> = (value: V, key: K, target: RemapTarget<K, V>) => U;
|
|
24
|
+
export type RemapOutputDefault<T extends RemapTarget<K, V>, K extends PKey, V, U = V> = RemapTarget<K, U>;
|
|
25
|
+
export type RemapOutputFiltered<T extends RemapTarget<K, V>, K extends PKey, V, U = V> = OmitIndexOfType<RemapOutputDefault<T, K, V, U>, NUN>;
|
|
26
|
+
export type RemapOutput<T extends RemapTarget<K, V>, K extends PKey, V, U = V, O extends RemapOptions = any> = O extends {
|
|
27
|
+
remove: true;
|
|
28
|
+
} ? RemapOutputFiltered<T, K, V, U> : RemapOutputDefault<T, K, V, U>;
|
|
29
|
+
/**
|
|
30
|
+
* Map an object keys and values
|
|
31
|
+
*/
|
|
32
|
+
export declare function objectRemap<K extends PKey, V, U = V, T = RemapTarget<K, V>>(target: RemapTarget<K, V>, callbackFn: RemapCallback<K, V, U>, options?: RemapOptions, thisArg?: ThisType<T>): RemapOutput<typeof target, K, V, U, typeof options>;
|
|
33
|
+
export default objectRemap;
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { _isUndT } from "../guards/lib/_is-und-t.js";
|
|
18
|
+
import cloneDeep from "../copy.js";
|
|
19
|
+
/**
|
|
20
|
+
* Map an object keys and values
|
|
21
|
+
*/ export function objectRemap(target, callbackFn, options, thisArg) {
|
|
22
|
+
// prettier-ignore
|
|
23
|
+
const remapped = (options == null ? void 0 : options.copy) === 'deep' ? cloneDeep(target) : (options == null ? void 0 : options.copy) === 'shallow' || (options == null ? void 0 : options.copy) === true ? _extends({}, target) : target;
|
|
24
|
+
const _thisArg = thisArg != null ? thisArg : remapped;
|
|
25
|
+
for(const key in target){
|
|
26
|
+
if (Object.hasOwn(target, key)) {
|
|
27
|
+
const value = callbackFn.call(_thisArg, target[key], key, target);
|
|
28
|
+
if ((options == null ? void 0 : options.remove) && _isUndT(value)) delete remapped[key];
|
|
29
|
+
else remapped[key] = value;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return remapped;
|
|
33
|
+
}
|
|
34
|
+
export default objectRemap;
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=object-remap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/object/object-remap.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 { _isUndT } from '../guards/lib/_is-und-t'\nimport cloneDeep from '../copy'\n\nexport type RemapOptions = {\n /** When true will remove 'undefined' values */\n remove?: boolean\n copy?: 'deep' | 'shallow' | boolean\n}\n\nexport type RemapTarget<K extends PKey, V = unknown> = Record<K, V>\n\nexport type RemapCallback<K extends PKey, V, U = V> = (\n value: V,\n key: K,\n target: RemapTarget<K, V>,\n) => U\n\nexport type RemapOutputDefault<\n T extends RemapTarget<K, V>,\n K extends PKey,\n V,\n U = V,\n> = RemapTarget<K, U>\n\n// prettier-ignore\nexport type RemapOutputFiltered<\n T extends RemapTarget<K, V>,\n K extends PKey,\n V,\n U = V,\n> = OmitIndexOfType<\n RemapOutputDefault<T, K, V, U>,\n NUN\n>\n\n// prettier-ignore\nexport type RemapOutput<\n T extends RemapTarget<K, V>,\n K extends PKey,\n V,\n U = V,\n O extends RemapOptions = any\n> =\n O extends {remove: true}\n ? RemapOutputFiltered<T, K, V, U>\n : RemapOutputDefault<T, K, V, U>\n\n/**\n * Map an object keys and values\n */\nexport function objectRemap<K extends PKey, V, U = V, T = RemapTarget<K, V>>(\n target: RemapTarget<K, V>,\n callbackFn: RemapCallback<K, V, U>,\n options?: RemapOptions,\n thisArg?: ThisType<T>,\n): RemapOutput<typeof target, K, V, U, typeof options> {\n type ThisArg = Conditional<typeof thisArg, NUN, typeof target, typeof thisArg>\n type Output = RemapOutput<typeof target, K, V, U, typeof options>\n\n // prettier-ignore\n const remapped = (\n options?.copy === 'deep'\n ? cloneDeep(target)\n : (\n options?.copy === 'shallow' || options?.copy === true\n ? {...target}\n : target\n )\n ) as unknown as Output\n\n const _thisArg = (thisArg ?? remapped) as ThisArg\n\n for (const key in target) {\n if (Object.hasOwn(target, key)) {\n const value = callbackFn.call(_thisArg, target[key], key, target)\n if (options?.remove && _isUndT(value)) delete remapped[key]\n else remapped[key] = value\n }\n }\n\n return remapped\n}\n\nexport default objectRemap\n"],"names":["_isUndT","cloneDeep","objectRemap","target","callbackFn","options","thisArg","remapped","copy","_thisArg","key","Object","hasOwn","value","call","remove"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,OAAO,QAAQ,6BAAyB;AACjD,OAAOC,eAAe,aAAS;AA8C/B;;CAEC,GACD,OAAO,SAASC,YACdC,MAAyB,EACzBC,UAAkC,EAClCC,OAAsB,EACtBC,OAAqB;IAKrB,kBAAkB;IAClB,MAAMC,WACJF,CAAAA,2BAAAA,QAASG,IAAI,MAAK,SACdP,UAAUE,UAEVE,CAAAA,2BAAAA,QAASG,IAAI,MAAK,aAAaH,CAAAA,2BAAAA,QAASG,IAAI,MAAK,OAC7C,aAAIL,UACJA;IAIV,MAAMM,WAAYH,kBAAAA,UAAWC;IAE7B,IAAK,MAAMG,OAAOP,OAAQ;QACxB,IAAIQ,OAAOC,MAAM,CAACT,QAAQO,MAAM;YAC9B,MAAMG,QAAQT,WAAWU,IAAI,CAACL,UAAUN,MAAM,CAACO,IAAI,EAAEA,KAAKP;YAC1D,IAAIE,CAAAA,2BAAAA,QAASU,MAAM,KAAIf,QAAQa,QAAQ,OAAON,QAAQ,CAACG,IAAI;iBACtDH,QAAQ,CAACG,IAAI,GAAGG;QACvB;IACF;IAEA,OAAON;AACT;AAEA,eAAeL,YAAW"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Safe object/{} will always return an object
|
|
19
|
+
*
|
|
20
|
+
* @export
|
|
21
|
+
* @template T
|
|
22
|
+
* @param {T} val
|
|
23
|
+
* @param {Record<string, unknown>} [or]
|
|
24
|
+
* @returns {Record<string, unknown>}
|
|
25
|
+
*/
|
|
26
|
+
export declare function objectSafe<T>(val: T, or?: Record<string, unknown>): Record<string, unknown>;
|
|
27
|
+
export default objectSafe;
|
|
@@ -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
|
+
*/ import { _isObj } from "../guards/index.js";
|
|
17
|
+
/**
|
|
18
|
+
* Safe object/{} will always return an object
|
|
19
|
+
*
|
|
20
|
+
* @export
|
|
21
|
+
* @template T
|
|
22
|
+
* @param {T} val
|
|
23
|
+
* @param {Record<string, unknown>} [or]
|
|
24
|
+
* @returns {Record<string, unknown>}
|
|
25
|
+
*/ export function objectSafe(val, or) {
|
|
26
|
+
return _isObj(val) ? val : _isObj(or) ? or : {};
|
|
27
|
+
}
|
|
28
|
+
export default objectSafe;
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=object-safe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/object/object-safe.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _isObj } from '../guards'\n\n\n/**\n * Safe object/{} will always return an object\n *\n * @export\n * @template T\n * @param {T} val\n * @param {Record<string, unknown>} [or]\n * @returns {Record<string, unknown>}\n */\nexport function objectSafe<T>(\n val: T,\n or?: Record<string, unknown>,\n): Record<string, unknown> {\n return _isObj(val) ? val : _isObj(or) ? or : {}\n}\n\nexport default objectSafe\n"],"names":["_isObj","objectSafe","val","or"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,MAAM,QAAQ,qBAAW;AAGlC;;;;;;;;CAQC,GACD,OAAO,SAASC,WACdC,GAAM,EACNC,EAA4B;IAE5B,OAAOH,OAAOE,OAAOA,MAAMF,OAAOG,MAAMA,KAAK,CAAC;AAChD;AAEA,eAAeF,WAAU"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
* Set a nested property within an object literal
|
|
19
|
+
*
|
|
20
|
+
* EXAMPLE:
|
|
21
|
+
* const obj = {'a': {'prop': {'that': 'exists'}}};
|
|
22
|
+
* setNestedProperty(obj, 'a.very.deep.prop', 'value')
|
|
23
|
+
*
|
|
24
|
+
* @see getProperty
|
|
25
|
+
* @see objectGetDeepProperty
|
|
26
|
+
*
|
|
27
|
+
* @export
|
|
28
|
+
* @template T
|
|
29
|
+
* @param {T} obj
|
|
30
|
+
* @param {string} path
|
|
31
|
+
* @param {*} val
|
|
32
|
+
* @param {string} [separator='.']
|
|
33
|
+
*/
|
|
34
|
+
export declare function objectSetDeepProperty<T>(obj: T, path: string, val: any, separator?: string): T;
|
|
35
|
+
export default objectSetDeepProperty;
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
* Set a nested property within an object literal
|
|
18
|
+
*
|
|
19
|
+
* EXAMPLE:
|
|
20
|
+
* const obj = {'a': {'prop': {'that': 'exists'}}};
|
|
21
|
+
* setNestedProperty(obj, 'a.very.deep.prop', 'value')
|
|
22
|
+
*
|
|
23
|
+
* @see getProperty
|
|
24
|
+
* @see objectGetDeepProperty
|
|
25
|
+
*
|
|
26
|
+
* @export
|
|
27
|
+
* @template T
|
|
28
|
+
* @param {T} obj
|
|
29
|
+
* @param {string} path
|
|
30
|
+
* @param {*} val
|
|
31
|
+
* @param {string} [separator='.']
|
|
32
|
+
*/ export function objectSetDeepProperty(obj, path, val, separator = '.') {
|
|
33
|
+
const keys = path.split(separator);
|
|
34
|
+
const lastKey = keys.pop();
|
|
35
|
+
const lastObj = keys.reduce((acc, item)=>{
|
|
36
|
+
var _acc, _item, _;
|
|
37
|
+
return (_ = (_acc = acc)[_item = item]) != null ? _ : _acc[_item] = {};
|
|
38
|
+
}, obj);
|
|
39
|
+
lastObj[lastKey] = val;
|
|
40
|
+
return obj;
|
|
41
|
+
}
|
|
42
|
+
export default objectSetDeepProperty;
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=object-set-deep-property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/object/object-set-deep-property.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Set a nested property within an object literal\n *\n * EXAMPLE:\n * const obj = {'a': {'prop': {'that': 'exists'}}};\n * setNestedProperty(obj, 'a.very.deep.prop', 'value')\n *\n * @see getProperty\n * @see objectGetDeepProperty\n *\n * @export\n * @template T\n * @param {T} obj\n * @param {string} path\n * @param {*} val\n * @param {string} [separator='.']\n */\nexport function objectSetDeepProperty<T>(\n obj: T,\n path: string,\n val: any,\n separator = '.',\n): T {\n const keys = path.split(separator)\n const lastKey = keys.pop()\n const lastObj = keys.reduce((acc: any, item) => (acc[item] ??= {}), obj as any)\n lastObj[lastKey] = val\n return obj\n}\n\nexport default objectSetDeepProperty\n"],"names":["objectSetDeepProperty","obj","path","val","separator","keys","split","lastKey","pop","lastObj","reduce","acc","item"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,SAASA,sBACdC,GAAM,EACNC,IAAY,EACZC,GAAQ,EACRC,YAAY,GAAG;IAEf,MAAMC,OAAOH,KAAKI,KAAK,CAACF;IACxB,MAAMG,UAAUF,KAAKG,GAAG;IACxB,MAAMC,UAAUJ,KAAKK,MAAM,CAAC,CAACC,KAAUC;YAAUD,MAAIC,OAAJD;gBAAAA,IAAAA,CAAAA,OAAAA,IAAG,CAACC,QAAAA,KAAK,YAATD,IAAAA,IAAG,CAACC,MAAK,GAAK,CAAC;OAAIX;IACpEQ,OAAO,CAACF,QAAQ,GAAGJ;IACnB,OAAOF;AACT;AAEA,eAAeD,sBAAqB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Shortcut for Object.assign({}, target, ...otherTargets)
|
|
19
|
+
*
|
|
20
|
+
* @export
|
|
21
|
+
* @template T
|
|
22
|
+
* @template U
|
|
23
|
+
* @param {T} target
|
|
24
|
+
* @param {...U[]} source
|
|
25
|
+
* @returns {(T & U)}
|
|
26
|
+
*/
|
|
27
|
+
export declare function objectUpdate<T, U>(target: T, ...source: U[]): T & U;
|
|
28
|
+
export default objectUpdate;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ /**
|
|
17
|
+
* Shortcut for Object.assign({}, target, ...otherTargets)
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @template T
|
|
21
|
+
* @template U
|
|
22
|
+
* @param {T} target
|
|
23
|
+
* @param {...U[]} source
|
|
24
|
+
* @returns {(T & U)}
|
|
25
|
+
*/ export function objectUpdate(target, ...source) {
|
|
26
|
+
// Encapsulate the idea of passing a new object as the first parameter
|
|
27
|
+
// to Object.assign to ensure we correctly copy data instead of mutating
|
|
28
|
+
return Object.assign({}, target, ...source);
|
|
29
|
+
}
|
|
30
|
+
export default objectUpdate;
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=object-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/object/object-update.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 * Shortcut for Object.assign({}, target, ...otherTargets)\n *\n * @export\n * @template T\n * @template U\n * @param {T} target\n * @param {...U[]} source\n * @returns {(T & U)}\n */\nexport function objectUpdate<T, U>(target: T, ...source: U[]): T & U {\n // Encapsulate the idea of passing a new object as the first parameter\n // to Object.assign to ensure we correctly copy data instead of mutating\n return Object.assign({}, target, ...source)\n}\n\nexport default objectUpdate\n"],"names":["objectUpdate","target","source","Object","assign"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;CASC,GACD,OAAO,SAASA,aAAmBC,MAAS,EAAE,GAAGC,MAAW;IAC1D,sEAAsE;IACtE,wEAAwE;IACxE,OAAOC,OAAOC,MAAM,CAAC,CAAC,GAAGH,WAAWC;AACtC;AAEA,eAAeF,aAAY"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { ComparisonOperator } from './definitions';
|
|
18
|
+
/**
|
|
19
|
+
* Perform comparison operation to check provided equality operator. If no
|
|
20
|
+
* operator is provided defaults to strict equality check
|
|
21
|
+
* @param left - left-hand side operand for operation
|
|
22
|
+
* @param right - right-hand side operand for operation
|
|
23
|
+
* @param operator - provide js comparison operator syntax as string literal
|
|
24
|
+
*/
|
|
25
|
+
export declare function compare<T>(left: Iterable<T> | ArrayLike<T> | number | string, right: Iterable<T> | ArrayLike<T> | number | string, operator?: ComparisonOperator): boolean;
|
|
26
|
+
export default compare;
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
* Perform comparison operation to check provided equality operator. If no
|
|
18
|
+
* operator is provided defaults to strict equality check
|
|
19
|
+
* @param left - left-hand side operand for operation
|
|
20
|
+
* @param right - right-hand side operand for operation
|
|
21
|
+
* @param operator - provide js comparison operator syntax as string literal
|
|
22
|
+
*/ export function compare(left, right, operator = '===') {
|
|
23
|
+
switch(operator){
|
|
24
|
+
case '==':
|
|
25
|
+
// noinspection EqualityComparisonWithCoercionJS
|
|
26
|
+
return left == right;
|
|
27
|
+
case '<':
|
|
28
|
+
return left < right;
|
|
29
|
+
case '<=':
|
|
30
|
+
return left <= right;
|
|
31
|
+
case '>=':
|
|
32
|
+
return left >= right;
|
|
33
|
+
case '>':
|
|
34
|
+
return left > right;
|
|
35
|
+
case '===':
|
|
36
|
+
default:
|
|
37
|
+
return left === right;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export default compare;
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=compare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/operator/compare.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 type { ComparisonOperator } from './definitions'\n\n\n/**\n * Perform comparison operation to check provided equality operator. If no\n * operator is provided defaults to strict equality check\n * @param left - left-hand side operand for operation\n * @param right - right-hand side operand for operation\n * @param operator - provide js comparison operator syntax as string literal\n */\nexport function compare<T>(\n left: Iterable<T> | ArrayLike<T> | number | string,\n right: Iterable<T> | ArrayLike<T> | number | string,\n operator: ComparisonOperator = '===',\n): boolean {\n switch (operator) {\n case '==':\n // noinspection EqualityComparisonWithCoercionJS\n return left == right\n case '<':\n return left < right\n case '<=':\n return left <= right\n case '>=':\n return left >= right\n case '>':\n return left > right\n case '===':\n default:\n return left === right\n }\n}\n\nexport default compare\n"],"names":["compare","left","right","operator"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAKD;;;;;;CAMC,GACD,OAAO,SAASA,QACdC,IAAkD,EAClDC,KAAmD,EACnDC,WAA+B,KAAK;IAEpC,OAAQA;QACN,KAAK;YACH,gDAAgD;YAChD,OAAOF,QAAQC;QACjB,KAAK;YACH,OAAOD,OAAOC;QAChB,KAAK;YACH,OAAOD,QAAQC;QACjB,KAAK;YACH,OAAOD,QAAQC;QACjB,KAAK;YACH,OAAOD,OAAOC;QAChB,KAAK;QACL;YACE,OAAOD,SAASC;IACpB;AACF;AAEA,eAAeF,QAAO"}
|