@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,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Generates a string with **_JSON_** representation of a value
|
|
19
|
+
*
|
|
20
|
+
* @see {@link jsonDeserialize}
|
|
21
|
+
* @see {@link JSON.parse}
|
|
22
|
+
* @see {@link JSON.stringify}
|
|
23
|
+
*/
|
|
24
|
+
export declare function jsonSerialize(...args: Parameters<typeof JSON.stringify>): ReturnType<typeof JSON.stringify>;
|
|
25
|
+
export default jsonSerialize;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ /**
|
|
17
|
+
* Generates a string with **_JSON_** representation of a value
|
|
18
|
+
*
|
|
19
|
+
* @see {@link jsonDeserialize}
|
|
20
|
+
* @see {@link JSON.parse}
|
|
21
|
+
* @see {@link JSON.stringify}
|
|
22
|
+
*/ export function jsonSerialize(...args) {
|
|
23
|
+
return JSON.stringify(...args);
|
|
24
|
+
}
|
|
25
|
+
export default jsonSerialize;
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=json-serialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/serialize/json-serialize.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 * Generates a string with **_JSON_** representation of a value\n *\n * @see {@link jsonDeserialize}\n * @see {@link JSON.parse}\n * @see {@link JSON.stringify}\n */\nexport function jsonSerialize(...args: Parameters<typeof JSON.stringify>): ReturnType<typeof JSON.stringify> {\n return JSON.stringify(...args)\n}\nexport default jsonSerialize\n"],"names":["jsonSerialize","args","JSON","stringify"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;CAMC,GACD,OAAO,SAASA,cAAc,GAAGC,IAAuC;IACtE,OAAOC,KAAKC,SAAS,IAAIF;AAC3B;AACA,eAAeD,cAAa"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { unserialize as phpSerialDeserializeFromByteStream } from 'php-serialize';
|
|
18
|
+
/**
|
|
19
|
+
* Generates a string with **_byte-stream_** representation of a value.
|
|
20
|
+
*
|
|
21
|
+
* **Note:**
|
|
22
|
+
* that this is a binary string which may include null bytes, and needs to be
|
|
23
|
+
* stored and handled as such. For example, serialize() output should generally
|
|
24
|
+
* be stored in a BLOB field in a database, rather than a CHAR or TEXT field.
|
|
25
|
+
*
|
|
26
|
+
* ---
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* export function serialize(
|
|
30
|
+
* item: any,
|
|
31
|
+
* phpToJsScope: Object = {},
|
|
32
|
+
* options: { encoding: 'utf8' | 'binary' } = { encoding: 'utf8' }
|
|
33
|
+
* ): string
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* class User {
|
|
37
|
+
* constructor({ name, age }) {
|
|
38
|
+
* this.name = name
|
|
39
|
+
* this.age = age
|
|
40
|
+
* }
|
|
41
|
+
* serialize() {
|
|
42
|
+
* return JSON.stringify({ name: this.name, age: this.age })
|
|
43
|
+
* }
|
|
44
|
+
* unserialize(rawData) {
|
|
45
|
+
* const { name, age } = JSON.parse(rawData)
|
|
46
|
+
* this.name = name
|
|
47
|
+
* this.age = age
|
|
48
|
+
* }
|
|
49
|
+
* }
|
|
50
|
+
* const steel = new User({ name: 'Steel Brain', age: 17 })
|
|
51
|
+
*
|
|
52
|
+
*
|
|
53
|
+
* // Serialize to byte stream string
|
|
54
|
+
* const serialized = serializeToByteStream(steel)
|
|
55
|
+
*
|
|
56
|
+
* // Serialize User class to given name
|
|
57
|
+
* const serializedForNamespace = serializeToByteStream(steel, {
|
|
58
|
+
* 'MyApp\\User': User,
|
|
59
|
+
* })
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* // Result: serialized
|
|
63
|
+
* "C:4:\"User\":31:{{\"name\":\"Steel Brain\",\"age\":17}}"
|
|
64
|
+
*
|
|
65
|
+
* // Result: serializedForNamespace
|
|
66
|
+
* "C:10:\"MyApp\\User\":31:{{\"name\":\"Steel Brain\",\"age\":17}}"
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* // Result: unserialized
|
|
70
|
+
* unserialized instanceof User = true
|
|
71
|
+
*
|
|
72
|
+
* @see {@link phpSerialIsSerialized}
|
|
73
|
+
* @see {@link phpSerialSerialize}
|
|
74
|
+
* @see {@link https://github.com/steelbrain/php-serialize|PHP Serializer}
|
|
75
|
+
*/
|
|
76
|
+
export { phpSerialDeserializeFromByteStream };
|
|
77
|
+
export default phpSerialDeserializeFromByteStream;
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { unserialize as phpSerialDeserializeFromByteStream } from "php-serialize";
|
|
17
|
+
/**
|
|
18
|
+
* Generates a string with **_byte-stream_** representation of a value.
|
|
19
|
+
*
|
|
20
|
+
* **Note:**
|
|
21
|
+
* that this is a binary string which may include null bytes, and needs to be
|
|
22
|
+
* stored and handled as such. For example, serialize() output should generally
|
|
23
|
+
* be stored in a BLOB field in a database, rather than a CHAR or TEXT field.
|
|
24
|
+
*
|
|
25
|
+
* ---
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* export function serialize(
|
|
29
|
+
* item: any,
|
|
30
|
+
* phpToJsScope: Object = {},
|
|
31
|
+
* options: { encoding: 'utf8' | 'binary' } = { encoding: 'utf8' }
|
|
32
|
+
* ): string
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* class User {
|
|
36
|
+
* constructor({ name, age }) {
|
|
37
|
+
* this.name = name
|
|
38
|
+
* this.age = age
|
|
39
|
+
* }
|
|
40
|
+
* serialize() {
|
|
41
|
+
* return JSON.stringify({ name: this.name, age: this.age })
|
|
42
|
+
* }
|
|
43
|
+
* unserialize(rawData) {
|
|
44
|
+
* const { name, age } = JSON.parse(rawData)
|
|
45
|
+
* this.name = name
|
|
46
|
+
* this.age = age
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* const steel = new User({ name: 'Steel Brain', age: 17 })
|
|
50
|
+
*
|
|
51
|
+
*
|
|
52
|
+
* // Serialize to byte stream string
|
|
53
|
+
* const serialized = serializeToByteStream(steel)
|
|
54
|
+
*
|
|
55
|
+
* // Serialize User class to given name
|
|
56
|
+
* const serializedForNamespace = serializeToByteStream(steel, {
|
|
57
|
+
* 'MyApp\\User': User,
|
|
58
|
+
* })
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // Result: serialized
|
|
62
|
+
* "C:4:\"User\":31:{{\"name\":\"Steel Brain\",\"age\":17}}"
|
|
63
|
+
*
|
|
64
|
+
* // Result: serializedForNamespace
|
|
65
|
+
* "C:10:\"MyApp\\User\":31:{{\"name\":\"Steel Brain\",\"age\":17}}"
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* // Result: unserialized
|
|
69
|
+
* unserialized instanceof User = true
|
|
70
|
+
*
|
|
71
|
+
* @see {@link phpSerialIsSerialized}
|
|
72
|
+
* @see {@link phpSerialSerialize}
|
|
73
|
+
* @see {@link https://github.com/steelbrain/php-serialize|PHP Serializer}
|
|
74
|
+
*/ export { phpSerialDeserializeFromByteStream };
|
|
75
|
+
export default phpSerialDeserializeFromByteStream;
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=php-serial-deserialize-from-byte-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/serialize/php-serial-deserialize-from-byte-stream.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 {unserialize as phpSerialDeserializeFromByteStream} from 'php-serialize'\n\n\n/**\n * Generates a string with **_byte-stream_** representation of a value.\n *\n * **Note:**\n * that this is a binary string which may include null bytes, and needs to be\n * stored and handled as such. For example, serialize() output should generally\n * be stored in a BLOB field in a database, rather than a CHAR or TEXT field.\n *\n * ---\n *\n * @example\n * export function serialize(\n * item: any,\n * phpToJsScope: Object = {},\n * options: { encoding: 'utf8' | 'binary' } = { encoding: 'utf8' }\n * ): string\n *\n * @example\n * class User {\n * constructor({ name, age }) {\n * this.name = name\n * this.age = age\n * }\n * serialize() {\n * return JSON.stringify({ name: this.name, age: this.age })\n * }\n * unserialize(rawData) {\n * const { name, age } = JSON.parse(rawData)\n * this.name = name\n * this.age = age\n * }\n * }\n * const steel = new User({ name: 'Steel Brain', age: 17 })\n *\n *\n * // Serialize to byte stream string\n * const serialized = serializeToByteStream(steel)\n *\n * // Serialize User class to given name\n * const serializedForNamespace = serializeToByteStream(steel, {\n * 'MyApp\\\\User': User,\n * })\n *\n * @example\n * // Result: serialized\n * \"C:4:\\\"User\\\":31:{{\\\"name\\\":\\\"Steel Brain\\\",\\\"age\\\":17}}\"\n *\n * // Result: serializedForNamespace\n * \"C:10:\\\"MyApp\\\\User\\\":31:{{\\\"name\\\":\\\"Steel Brain\\\",\\\"age\\\":17}}\"\n *\n * @example\n * // Result: unserialized\n * unserialized instanceof User = true\n *\n * @see {@link phpSerialIsSerialized}\n * @see {@link phpSerialSerialize}\n * @see {@link https://github.com/steelbrain/php-serialize|PHP Serializer}\n */\nexport {phpSerialDeserializeFromByteStream}\nexport default phpSerialDeserializeFromByteStream\n"],"names":["unserialize","phpSerialDeserializeFromByteStream"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAAQA,eAAeC,kCAAkC,QAAO,gBAAe;AAG/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDC,GACD,SAAQA,kCAAkC,GAAC;AAC3C,eAAeA,mCAAkC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { isSerialized as phpSerialIsSerializedByteStream } from 'php-serialize';
|
|
18
|
+
/**
|
|
19
|
+
* Generates a string with **_byte-stream_** representation of a value.
|
|
20
|
+
*
|
|
21
|
+
* **Note:**
|
|
22
|
+
* that this is a binary string which may include null bytes, and needs to be
|
|
23
|
+
* stored and handled as such. For example, serialize() output should generally
|
|
24
|
+
* be stored in a BLOB field in a database, rather than a CHAR or TEXT field.
|
|
25
|
+
*
|
|
26
|
+
* ---
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* export function serialize(
|
|
30
|
+
* item: any,
|
|
31
|
+
* phpToJsScope: Object = {},
|
|
32
|
+
* options: { encoding: 'utf8' | 'binary' } = { encoding: 'utf8' }
|
|
33
|
+
* ): string
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* class User {
|
|
37
|
+
* constructor({ name, age }) {
|
|
38
|
+
* this.name = name
|
|
39
|
+
* this.age = age
|
|
40
|
+
* }
|
|
41
|
+
* serialize() {
|
|
42
|
+
* return JSON.stringify({ name: this.name, age: this.age })
|
|
43
|
+
* }
|
|
44
|
+
* unserialize(rawData) {
|
|
45
|
+
* const { name, age } = JSON.parse(rawData)
|
|
46
|
+
* this.name = name
|
|
47
|
+
* this.age = age
|
|
48
|
+
* }
|
|
49
|
+
* }
|
|
50
|
+
* const steel = new User({ name: 'Steel Brain', age: 17 })
|
|
51
|
+
*
|
|
52
|
+
*
|
|
53
|
+
* // Serialize to byte stream string
|
|
54
|
+
* const serialized = serializeToByteStream(steel)
|
|
55
|
+
*
|
|
56
|
+
* // Serialize User class to given name
|
|
57
|
+
* const serializedForNamespace = serializeToByteStream(steel, {
|
|
58
|
+
* 'MyApp\\User': User,
|
|
59
|
+
* })
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* // Result: serialized
|
|
63
|
+
* "C:4:\"User\":31:{{\"name\":\"Steel Brain\",\"age\":17}}"
|
|
64
|
+
*
|
|
65
|
+
* // Result: serializedForNamespace
|
|
66
|
+
* "C:10:\"MyApp\\User\":31:{{\"name\":\"Steel Brain\",\"age\":17}}"
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* // Result: unserialized
|
|
70
|
+
* unserialized instanceof User = true
|
|
71
|
+
*
|
|
72
|
+
* @see {@link phpSerialIsSerialized}
|
|
73
|
+
* @see {@link phpSerialSerialize}
|
|
74
|
+
* @see {@link https://github.com/steelbrain/php-serialize|PHP Serializer}
|
|
75
|
+
*/
|
|
76
|
+
export { phpSerialIsSerializedByteStream };
|
|
77
|
+
export default phpSerialIsSerializedByteStream;
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { isSerialized as phpSerialIsSerializedByteStream } from "php-serialize";
|
|
17
|
+
/**
|
|
18
|
+
* Generates a string with **_byte-stream_** representation of a value.
|
|
19
|
+
*
|
|
20
|
+
* **Note:**
|
|
21
|
+
* that this is a binary string which may include null bytes, and needs to be
|
|
22
|
+
* stored and handled as such. For example, serialize() output should generally
|
|
23
|
+
* be stored in a BLOB field in a database, rather than a CHAR or TEXT field.
|
|
24
|
+
*
|
|
25
|
+
* ---
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* export function serialize(
|
|
29
|
+
* item: any,
|
|
30
|
+
* phpToJsScope: Object = {},
|
|
31
|
+
* options: { encoding: 'utf8' | 'binary' } = { encoding: 'utf8' }
|
|
32
|
+
* ): string
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* class User {
|
|
36
|
+
* constructor({ name, age }) {
|
|
37
|
+
* this.name = name
|
|
38
|
+
* this.age = age
|
|
39
|
+
* }
|
|
40
|
+
* serialize() {
|
|
41
|
+
* return JSON.stringify({ name: this.name, age: this.age })
|
|
42
|
+
* }
|
|
43
|
+
* unserialize(rawData) {
|
|
44
|
+
* const { name, age } = JSON.parse(rawData)
|
|
45
|
+
* this.name = name
|
|
46
|
+
* this.age = age
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* const steel = new User({ name: 'Steel Brain', age: 17 })
|
|
50
|
+
*
|
|
51
|
+
*
|
|
52
|
+
* // Serialize to byte stream string
|
|
53
|
+
* const serialized = serializeToByteStream(steel)
|
|
54
|
+
*
|
|
55
|
+
* // Serialize User class to given name
|
|
56
|
+
* const serializedForNamespace = serializeToByteStream(steel, {
|
|
57
|
+
* 'MyApp\\User': User,
|
|
58
|
+
* })
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // Result: serialized
|
|
62
|
+
* "C:4:\"User\":31:{{\"name\":\"Steel Brain\",\"age\":17}}"
|
|
63
|
+
*
|
|
64
|
+
* // Result: serializedForNamespace
|
|
65
|
+
* "C:10:\"MyApp\\User\":31:{{\"name\":\"Steel Brain\",\"age\":17}}"
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* // Result: unserialized
|
|
69
|
+
* unserialized instanceof User = true
|
|
70
|
+
*
|
|
71
|
+
* @see {@link phpSerialIsSerialized}
|
|
72
|
+
* @see {@link phpSerialSerialize}
|
|
73
|
+
* @see {@link https://github.com/steelbrain/php-serialize|PHP Serializer}
|
|
74
|
+
*/ export { phpSerialIsSerializedByteStream };
|
|
75
|
+
export default phpSerialIsSerializedByteStream;
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=php-serial-is-serialized-byte-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/serialize/php-serial-is-serialized-byte-stream.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 {isSerialized as phpSerialIsSerializedByteStream} from 'php-serialize'\n\n\n/**\n * Generates a string with **_byte-stream_** representation of a value.\n *\n * **Note:**\n * that this is a binary string which may include null bytes, and needs to be\n * stored and handled as such. For example, serialize() output should generally\n * be stored in a BLOB field in a database, rather than a CHAR or TEXT field.\n *\n * ---\n *\n * @example\n * export function serialize(\n * item: any,\n * phpToJsScope: Object = {},\n * options: { encoding: 'utf8' | 'binary' } = { encoding: 'utf8' }\n * ): string\n *\n * @example\n * class User {\n * constructor({ name, age }) {\n * this.name = name\n * this.age = age\n * }\n * serialize() {\n * return JSON.stringify({ name: this.name, age: this.age })\n * }\n * unserialize(rawData) {\n * const { name, age } = JSON.parse(rawData)\n * this.name = name\n * this.age = age\n * }\n * }\n * const steel = new User({ name: 'Steel Brain', age: 17 })\n *\n *\n * // Serialize to byte stream string\n * const serialized = serializeToByteStream(steel)\n *\n * // Serialize User class to given name\n * const serializedForNamespace = serializeToByteStream(steel, {\n * 'MyApp\\\\User': User,\n * })\n *\n * @example\n * // Result: serialized\n * \"C:4:\\\"User\\\":31:{{\\\"name\\\":\\\"Steel Brain\\\",\\\"age\\\":17}}\"\n *\n * // Result: serializedForNamespace\n * \"C:10:\\\"MyApp\\\\User\\\":31:{{\\\"name\\\":\\\"Steel Brain\\\",\\\"age\\\":17}}\"\n *\n * @example\n * // Result: unserialized\n * unserialized instanceof User = true\n *\n * @see {@link phpSerialIsSerialized}\n * @see {@link phpSerialSerialize}\n * @see {@link https://github.com/steelbrain/php-serialize|PHP Serializer}\n */\nexport {phpSerialIsSerializedByteStream}\nexport default phpSerialIsSerializedByteStream\n"],"names":["isSerialized","phpSerialIsSerializedByteStream"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAAQA,gBAAgBC,+BAA+B,QAAO,gBAAe;AAG7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDC,GACD,SAAQA,+BAA+B,GAAC;AACxC,eAAeA,gCAA+B"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { serialize as phpSerialSerializeToByteStream } from 'php-serialize';
|
|
18
|
+
/**
|
|
19
|
+
* Generates a string with **_byte-stream_** representation of a value.
|
|
20
|
+
*
|
|
21
|
+
* **Note:**
|
|
22
|
+
* that this is a binary string which may include null bytes, and needs to be
|
|
23
|
+
* stored and handled as such. For example, serialize() output should generally
|
|
24
|
+
* be stored in a BLOB field in a database, rather than a CHAR or TEXT field.
|
|
25
|
+
*
|
|
26
|
+
* ---
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* export function serialize(
|
|
30
|
+
* item: any,
|
|
31
|
+
* phpToJsScope: Object = {},
|
|
32
|
+
* options: { encoding: 'utf8' | 'binary' } = { encoding: 'utf8' }
|
|
33
|
+
* ): string
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* class User {
|
|
37
|
+
* constructor({ name, age }) {
|
|
38
|
+
* this.name = name
|
|
39
|
+
* this.age = age
|
|
40
|
+
* }
|
|
41
|
+
* serialize() {
|
|
42
|
+
* return JSON.stringify({ name: this.name, age: this.age })
|
|
43
|
+
* }
|
|
44
|
+
* unserialize(rawData) {
|
|
45
|
+
* const { name, age } = JSON.parse(rawData)
|
|
46
|
+
* this.name = name
|
|
47
|
+
* this.age = age
|
|
48
|
+
* }
|
|
49
|
+
* }
|
|
50
|
+
* const steel = new User({ name: 'Steel Brain', age: 17 })
|
|
51
|
+
*
|
|
52
|
+
*
|
|
53
|
+
* // Serialize to byte stream string
|
|
54
|
+
* const serialized = serializeToByteStream(steel)
|
|
55
|
+
*
|
|
56
|
+
* // Serialize User class to given name
|
|
57
|
+
* const serializedForNamespace = serializeToByteStream(steel, {
|
|
58
|
+
* 'MyApp\\User': User,
|
|
59
|
+
* })
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* // Result: serialized
|
|
63
|
+
* "C:4:\"User\":31:{{\"name\":\"Steel Brain\",\"age\":17}}"
|
|
64
|
+
*
|
|
65
|
+
* // Result: serializedForNamespace
|
|
66
|
+
* "C:10:\"MyApp\\User\":31:{{\"name\":\"Steel Brain\",\"age\":17}}"
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* // Result: unserialized
|
|
70
|
+
* unserialized instanceof User = true
|
|
71
|
+
*
|
|
72
|
+
* @see {@link phpSerialIsSerialized}
|
|
73
|
+
* @see {@link phpSerialSerialize}
|
|
74
|
+
* @see {@link https://github.com/steelbrain/php-serialize|PHP Serializer}
|
|
75
|
+
*/
|
|
76
|
+
export { phpSerialSerializeToByteStream };
|
|
77
|
+
export default phpSerialSerializeToByteStream;
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { serialize as phpSerialSerializeToByteStream } from "php-serialize";
|
|
17
|
+
/**
|
|
18
|
+
* Generates a string with **_byte-stream_** representation of a value.
|
|
19
|
+
*
|
|
20
|
+
* **Note:**
|
|
21
|
+
* that this is a binary string which may include null bytes, and needs to be
|
|
22
|
+
* stored and handled as such. For example, serialize() output should generally
|
|
23
|
+
* be stored in a BLOB field in a database, rather than a CHAR or TEXT field.
|
|
24
|
+
*
|
|
25
|
+
* ---
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* export function serialize(
|
|
29
|
+
* item: any,
|
|
30
|
+
* phpToJsScope: Object = {},
|
|
31
|
+
* options: { encoding: 'utf8' | 'binary' } = { encoding: 'utf8' }
|
|
32
|
+
* ): string
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* class User {
|
|
36
|
+
* constructor({ name, age }) {
|
|
37
|
+
* this.name = name
|
|
38
|
+
* this.age = age
|
|
39
|
+
* }
|
|
40
|
+
* serialize() {
|
|
41
|
+
* return JSON.stringify({ name: this.name, age: this.age })
|
|
42
|
+
* }
|
|
43
|
+
* unserialize(rawData) {
|
|
44
|
+
* const { name, age } = JSON.parse(rawData)
|
|
45
|
+
* this.name = name
|
|
46
|
+
* this.age = age
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* const steel = new User({ name: 'Steel Brain', age: 17 })
|
|
50
|
+
*
|
|
51
|
+
*
|
|
52
|
+
* // Serialize to byte stream string
|
|
53
|
+
* const serialized = serializeToByteStream(steel)
|
|
54
|
+
*
|
|
55
|
+
* // Serialize User class to given name
|
|
56
|
+
* const serializedForNamespace = serializeToByteStream(steel, {
|
|
57
|
+
* 'MyApp\\User': User,
|
|
58
|
+
* })
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // Result: serialized
|
|
62
|
+
* "C:4:\"User\":31:{{\"name\":\"Steel Brain\",\"age\":17}}"
|
|
63
|
+
*
|
|
64
|
+
* // Result: serializedForNamespace
|
|
65
|
+
* "C:10:\"MyApp\\User\":31:{{\"name\":\"Steel Brain\",\"age\":17}}"
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* // Result: unserialized
|
|
69
|
+
* unserialized instanceof User = true
|
|
70
|
+
*
|
|
71
|
+
* @see {@link phpSerialIsSerialized}
|
|
72
|
+
* @see {@link phpSerialSerialize}
|
|
73
|
+
* @see {@link https://github.com/steelbrain/php-serialize|PHP Serializer}
|
|
74
|
+
*/ export { phpSerialSerializeToByteStream };
|
|
75
|
+
export default phpSerialSerializeToByteStream;
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=php-serial-serialize-to-byte-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/util/tools/src/lib/serialize/php-serial-serialize-to-byte-stream.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 {serialize as phpSerialSerializeToByteStream} from 'php-serialize'\n\n\n/**\n * Generates a string with **_byte-stream_** representation of a value.\n *\n * **Note:**\n * that this is a binary string which may include null bytes, and needs to be\n * stored and handled as such. For example, serialize() output should generally\n * be stored in a BLOB field in a database, rather than a CHAR or TEXT field.\n *\n * ---\n *\n * @example\n * export function serialize(\n * item: any,\n * phpToJsScope: Object = {},\n * options: { encoding: 'utf8' | 'binary' } = { encoding: 'utf8' }\n * ): string\n *\n * @example\n * class User {\n * constructor({ name, age }) {\n * this.name = name\n * this.age = age\n * }\n * serialize() {\n * return JSON.stringify({ name: this.name, age: this.age })\n * }\n * unserialize(rawData) {\n * const { name, age } = JSON.parse(rawData)\n * this.name = name\n * this.age = age\n * }\n * }\n * const steel = new User({ name: 'Steel Brain', age: 17 })\n *\n *\n * // Serialize to byte stream string\n * const serialized = serializeToByteStream(steel)\n *\n * // Serialize User class to given name\n * const serializedForNamespace = serializeToByteStream(steel, {\n * 'MyApp\\\\User': User,\n * })\n *\n * @example\n * // Result: serialized\n * \"C:4:\\\"User\\\":31:{{\\\"name\\\":\\\"Steel Brain\\\",\\\"age\\\":17}}\"\n *\n * // Result: serializedForNamespace\n * \"C:10:\\\"MyApp\\\\User\\\":31:{{\\\"name\\\":\\\"Steel Brain\\\",\\\"age\\\":17}}\"\n *\n * @example\n * // Result: unserialized\n * unserialized instanceof User = true\n *\n * @see {@link phpSerialIsSerialized}\n * @see {@link phpSerialSerialize}\n * @see {@link https://github.com/steelbrain/php-serialize|PHP Serializer}\n */\nexport {phpSerialSerializeToByteStream}\nexport default phpSerialSerializeToByteStream\n"],"names":["serialize","phpSerialSerializeToByteStream"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAAQA,aAAaC,8BAA8B,QAAO,gBAAe;AAGzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDC,GACD,SAAQA,8BAA8B,GAAC;AACvC,eAAeA,+BAA8B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export interface SplitDisplayName {
|
|
18
|
+
firstName: string;
|
|
19
|
+
lastName: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A single `displayName` split into the first/last pair the console profile
|
|
23
|
+
* stores (AGL-1127). Identity providers hand us one string — Google and a
|
|
24
|
+
* SAML assertion both do — while `users/{uid}` and the Basic info form are
|
|
25
|
+
* two fields, so seeding a profile from a provider needs a split.
|
|
26
|
+
*
|
|
27
|
+
* Everything after the first space is the last name, so multi-word family
|
|
28
|
+
* names ("Ada Lovelace King") survive intact. A single word is a first name
|
|
29
|
+
* with no last name rather than a guess, and an empty/absent value yields two
|
|
30
|
+
* empty strings — the caller decides whether that is worth writing.
|
|
31
|
+
*
|
|
32
|
+
* Deliberately naive: this is a SEED for a form the user can edit, not an
|
|
33
|
+
* attempt to parse names correctly, which is not something a splitter can do.
|
|
34
|
+
*/
|
|
35
|
+
export declare function splitDisplayName(displayName?: string | null): SplitDisplayName;
|
|
36
|
+
export default splitDisplayName;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ /**
|
|
17
|
+
* A single `displayName` split into the first/last pair the console profile
|
|
18
|
+
* stores (AGL-1127). Identity providers hand us one string — Google and a
|
|
19
|
+
* SAML assertion both do — while `users/{uid}` and the Basic info form are
|
|
20
|
+
* two fields, so seeding a profile from a provider needs a split.
|
|
21
|
+
*
|
|
22
|
+
* Everything after the first space is the last name, so multi-word family
|
|
23
|
+
* names ("Ada Lovelace King") survive intact. A single word is a first name
|
|
24
|
+
* with no last name rather than a guess, and an empty/absent value yields two
|
|
25
|
+
* empty strings — the caller decides whether that is worth writing.
|
|
26
|
+
*
|
|
27
|
+
* Deliberately naive: this is a SEED for a form the user can edit, not an
|
|
28
|
+
* attempt to parse names correctly, which is not something a splitter can do.
|
|
29
|
+
*/ export function splitDisplayName(displayName) {
|
|
30
|
+
const cleaned = String(displayName != null ? displayName : '').replace(/\s+/g, ' ').trim();
|
|
31
|
+
if (!cleaned) return {
|
|
32
|
+
firstName: '',
|
|
33
|
+
lastName: ''
|
|
34
|
+
};
|
|
35
|
+
const boundary = cleaned.indexOf(' ');
|
|
36
|
+
if (boundary === -1) return {
|
|
37
|
+
firstName: cleaned,
|
|
38
|
+
lastName: ''
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
firstName: cleaned.slice(0, boundary),
|
|
42
|
+
lastName: cleaned.slice(boundary + 1)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export default splitDisplayName;
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=split-display-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/shared/util/tools/src/lib/split-display-name.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\nexport interface SplitDisplayName {\n firstName: string\n lastName: string\n}\n\n/**\n * A single `displayName` split into the first/last pair the console profile\n * stores (AGL-1127). Identity providers hand us one string — Google and a\n * SAML assertion both do — while `users/{uid}` and the Basic info form are\n * two fields, so seeding a profile from a provider needs a split.\n *\n * Everything after the first space is the last name, so multi-word family\n * names (\"Ada Lovelace King\") survive intact. A single word is a first name\n * with no last name rather than a guess, and an empty/absent value yields two\n * empty strings — the caller decides whether that is worth writing.\n *\n * Deliberately naive: this is a SEED for a form the user can edit, not an\n * attempt to parse names correctly, which is not something a splitter can do.\n */\nexport function splitDisplayName(\n displayName?: string | null,\n): SplitDisplayName {\n const cleaned = String(displayName ?? '')\n .replace(/\\s+/g, ' ')\n .trim()\n if (!cleaned) return { firstName: '', lastName: '' }\n const boundary = cleaned.indexOf(' ')\n if (boundary === -1) return { firstName: cleaned, lastName: '' }\n return {\n firstName: cleaned.slice(0, boundary),\n lastName: cleaned.slice(boundary + 1),\n }\n}\n\nexport default splitDisplayName\n"],"names":["splitDisplayName","displayName","cleaned","String","replace","trim","firstName","lastName","boundary","indexOf","slice"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAOD;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASA,iBACdC,WAA2B;IAE3B,MAAMC,UAAUC,OAAOF,sBAAAA,cAAe,IACnCG,OAAO,CAAC,QAAQ,KAChBC,IAAI;IACP,IAAI,CAACH,SAAS,OAAO;QAAEI,WAAW;QAAIC,UAAU;IAAG;IACnD,MAAMC,WAAWN,QAAQO,OAAO,CAAC;IACjC,IAAID,aAAa,CAAC,GAAG,OAAO;QAAEF,WAAWJ;QAASK,UAAU;IAAG;IAC/D,OAAO;QACLD,WAAWJ,QAAQQ,KAAK,CAAC,GAAGF;QAC5BD,UAAUL,QAAQQ,KAAK,CAACF,WAAW;IACrC;AACF;AAEA,eAAeR,iBAAgB"}
|
package/src/lib/str.d.ts
ADDED
|
@@ -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
|
+
* Shortcut for spreading multiple strings String(...)
|
|
19
|
+
*/
|
|
20
|
+
export declare function str(...val: any[]): string;
|
|
21
|
+
export default str;
|