@clementine-solutions/jane-io 1.0.1 → 1.0.2
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/dist/core/analysis/diff.js +88 -0
- package/dist/core/analysis/explain.js +117 -0
- package/dist/core/analysis/index.js +26 -0
- package/dist/core/analysis/replay.js +68 -0
- package/dist/core/analysis/telemetry.js +123 -0
- package/dist/core/boundary-rules/at-most-one.js +38 -0
- package/dist/core/boundary-rules/conditionally-required.js +44 -0
- package/dist/core/boundary-rules/date-range.js +39 -0
- package/dist/core/boundary-rules/index.js +21 -0
- package/dist/core/boundary-rules/mutually-exclusive.js +38 -0
- package/dist/core/boundary-rules/no-unknown-fields.js +39 -0
- package/dist/core/boundary-rules/require-all.js +39 -0
- package/dist/core/boundary-rules/require-one.js +41 -0
- package/dist/core/common/events.js +82 -0
- package/dist/core/common/fluent.js +429 -0
- package/dist/core/common/index.js +31 -0
- package/dist/core/common/policy.js +550 -0
- package/dist/core/common/utilities.js +177 -0
- package/dist/core/common/wildcard.js +63 -0
- package/dist/core/field-path/construct.js +189 -0
- package/dist/core/field-path/format.js +154 -0
- package/dist/core/field-path/index.js +26 -0
- package/dist/core/field-path/utilities.js +138 -0
- package/dist/core/field-path/walk.js +80 -0
- package/dist/core/fluent-registry.js +151 -0
- package/dist/core/normalizers/array/compact-sparse-array.js +40 -0
- package/dist/core/normalizers/array/flatten-one-level.js +45 -0
- package/dist/core/normalizers/array/remove-empty-string-items.js +34 -0
- package/dist/core/normalizers/array/remove-null-items.js +34 -0
- package/dist/core/normalizers/array/remove-undefined-items.js +34 -0
- package/dist/core/normalizers/date/invalid-date-to-undefined.js +35 -0
- package/dist/core/normalizers/index.js +46 -0
- package/dist/core/normalizers/normalizer-register.js +41 -0
- package/dist/core/normalizers/number/infinity-to-undefined.js +35 -0
- package/dist/core/normalizers/number/nan-to-undefined.js +34 -0
- package/dist/core/normalizers/number/normalize-negative-zero.js +33 -0
- package/dist/core/normalizers/object/remove-empty-array-keys.js +38 -0
- package/dist/core/normalizers/object/remove-empty-object-keys.js +42 -0
- package/dist/core/normalizers/object/remove-empty-string-keys.js +37 -0
- package/dist/core/normalizers/object/remove-null-keys.js +37 -0
- package/dist/core/normalizers/object/remove-undefined-keys.js +37 -0
- package/dist/core/normalizers/string/collapse-whitespace.js +35 -0
- package/dist/core/normalizers/string/empty-to-undefined.js +33 -0
- package/dist/core/normalizers/string/trim.js +34 -0
- package/dist/core/parsers/index.js +43 -0
- package/dist/core/parsers/parse-array-string.js +36 -0
- package/dist/core/parsers/parse-bigint-string.js +33 -0
- package/dist/core/parsers/parse-binary-string.js +33 -0
- package/dist/core/parsers/parse-boolean-string.js +27 -0
- package/dist/core/parsers/parse-date-string.js +30 -0
- package/dist/core/parsers/parse-duration-string.js +37 -0
- package/dist/core/parsers/parse-hex-string.js +29 -0
- package/dist/core/parsers/parse-integer-string.js +30 -0
- package/dist/core/parsers/parse-json-string.js +35 -0
- package/dist/core/parsers/parse-numeric-string.js +29 -0
- package/dist/core/parsers/parse-object-string.js +36 -0
- package/dist/core/parsers/parse-octal-string.js +33 -0
- package/dist/core/parsers/parse-scientific-notation-string.js +30 -0
- package/dist/core/parsers/parse-url-string.js +36 -0
- package/dist/core/pipeline/boundary.js +256 -0
- package/dist/core/pipeline/contain.js +339 -0
- package/dist/core/pipeline/index.js +37 -0
- package/dist/core/pipeline/normalize.js +76 -0
- package/dist/core/pipeline/parse.js +91 -0
- package/dist/core/pipeline/pipeline.js +418 -0
- package/dist/core/pipeline/scan.js +115 -0
- package/dist/core/pipeline/validate.js +74 -0
- package/dist/core/scanners/any/scan-for-sentinels.js +35 -0
- package/dist/core/scanners/array/array-is-deep.js +38 -0
- package/dist/core/scanners/array/array-is-heterogenous.js +39 -0
- package/dist/core/scanners/array/array-is-large.js +32 -0
- package/dist/core/scanners/bigint/bigint-is-large.js +34 -0
- package/dist/core/scanners/bigint/bigint-not-safe.js +34 -0
- package/dist/core/scanners/date/date-is-before-epoch.js +32 -0
- package/dist/core/scanners/date/date-is-far-future.js +32 -0
- package/dist/core/scanners/date/date-is-invalid.js +31 -0
- package/dist/core/scanners/index.js +58 -0
- package/dist/core/scanners/number/number-is-infinite.js +31 -0
- package/dist/core/scanners/number/number-is-nan.js +31 -0
- package/dist/core/scanners/number/number-is-too-large.js +33 -0
- package/dist/core/scanners/number/number-is-unsafe-integer.js +31 -0
- package/dist/core/scanners/object/object-has-circular-references.js +43 -0
- package/dist/core/scanners/object/object-has-many-keys.js +33 -0
- package/dist/core/scanners/object/object-is-deep.js +38 -0
- package/dist/core/scanners/scanner-registry.js +36 -0
- package/dist/core/scanners/string/string-has-unsafe-unicode.js +32 -0
- package/dist/core/scanners/string/string-has-whitespace-edges.js +31 -0
- package/dist/core/scanners/string/string-is-long.js +32 -0
- package/dist/core/scanners/unknown/unknown-not-scannable.js +34 -0
- package/dist/core/shapes/analysis.js +11 -0
- package/dist/core/shapes/boundary.js +11 -0
- package/dist/core/shapes/events.js +10 -0
- package/dist/core/shapes/field-path.js +10 -0
- package/dist/core/shapes/index.js +11 -0
- package/dist/core/shapes/normalize.js +11 -0
- package/dist/core/shapes/parse.js +11 -0
- package/dist/core/shapes/pipeline.js +11 -0
- package/dist/core/shapes/policy.js +11 -0
- package/dist/core/shapes/public.js +10 -0
- package/dist/core/shapes/scan.js +11 -0
- package/dist/core/shapes/validate.js +11 -0
- package/dist/core/validators/array/array-max-items.js +42 -0
- package/dist/core/validators/array/array-min-items.js +42 -0
- package/dist/core/validators/array/array.js +34 -0
- package/dist/core/validators/array/excludes.js +47 -0
- package/dist/core/validators/array/has-unique-items.js +46 -0
- package/dist/core/validators/array/includes.js +46 -0
- package/dist/core/validators/array/items-equal.js +42 -0
- package/dist/core/validators/array/no-empty-string-items.js +46 -0
- package/dist/core/validators/array/no-null-items.js +46 -0
- package/dist/core/validators/array/no-undefined-items.js +45 -0
- package/dist/core/validators/array/non-empty-array.js +45 -0
- package/dist/core/validators/array/not-sparse.js +44 -0
- package/dist/core/validators/bigint/bigint-equals.js +57 -0
- package/dist/core/validators/bigint/bigint-max.js +63 -0
- package/dist/core/validators/bigint/bigint-min.js +87 -0
- package/dist/core/validators/bigint/bigint-negative.js +73 -0
- package/dist/core/validators/bigint/bigint-non-negative.js +72 -0
- package/dist/core/validators/bigint/bigint-non-positive.js +72 -0
- package/dist/core/validators/bigint/bigint-positive.js +72 -0
- package/dist/core/validators/bigint/bigint-safe.js +75 -0
- package/dist/core/validators/bigint/bigint.js +38 -0
- package/dist/core/validators/boolean/boolean.js +39 -0
- package/dist/core/validators/boolean/is-false.js +48 -0
- package/dist/core/validators/boolean/is-true.js +48 -0
- package/dist/core/validators/common/is-country-code.js +36 -0
- package/dist/core/validators/common/is-currency-code.js +36 -0
- package/dist/core/validators/common/is-email-strict.js +36 -0
- package/dist/core/validators/common/is-email.js +36 -0
- package/dist/core/validators/common/is-ip.js +37 -0
- package/dist/core/validators/common/is-phone-strict.js +36 -0
- package/dist/core/validators/common/is-phone.js +36 -0
- package/dist/core/validators/common/is-port.js +35 -0
- package/dist/core/validators/common/is-postal-code.js +36 -0
- package/dist/core/validators/common/is-url.js +38 -0
- package/dist/core/validators/common/is-uuid.js +36 -0
- package/dist/core/validators/date/before-epoch.js +56 -0
- package/dist/core/validators/date/date-now-required.js +48 -0
- package/dist/core/validators/date/is-date.js +47 -0
- package/dist/core/validators/date/is-far-future.js +46 -0
- package/dist/core/validators/date/is-future.js +59 -0
- package/dist/core/validators/date/is-past.js +59 -0
- package/dist/core/validators/date/not-after.js +66 -0
- package/dist/core/validators/date/not-before.js +66 -0
- package/dist/core/validators/date/same-day.js +60 -0
- package/dist/core/validators/date/same-month.js +59 -0
- package/dist/core/validators/date/same-year.js +56 -0
- package/dist/core/validators/date/too-early.js +57 -0
- package/dist/core/validators/date/too-late.js +57 -0
- package/dist/core/validators/date/weekday.js +65 -0
- package/dist/core/validators/date/weekend.js +56 -0
- package/dist/core/validators/index.js +139 -0
- package/dist/core/validators/nullish/is-null-or-undefined.js +40 -0
- package/dist/core/validators/nullish/is-null.js +39 -0
- package/dist/core/validators/nullish/is-undefined.js +39 -0
- package/dist/core/validators/number/finite.js +40 -0
- package/dist/core/validators/number/integer.js +40 -0
- package/dist/core/validators/number/less-than.js +39 -0
- package/dist/core/validators/number/max.js +39 -0
- package/dist/core/validators/number/min.js +39 -0
- package/dist/core/validators/number/more-than.js +39 -0
- package/dist/core/validators/number/negative.js +38 -0
- package/dist/core/validators/number/non-negative.js +37 -0
- package/dist/core/validators/number/non-positive.js +37 -0
- package/dist/core/validators/number/number.js +31 -0
- package/dist/core/validators/number/positive.js +38 -0
- package/dist/core/validators/number/safe-integer.js +42 -0
- package/dist/core/validators/object/deep-equals.js +47 -0
- package/dist/core/validators/object/has-key.js +42 -0
- package/dist/core/validators/object/has-value.js +59 -0
- package/dist/core/validators/object/keys-equal.js +47 -0
- package/dist/core/validators/object/max-keys.js +43 -0
- package/dist/core/validators/object/min-keys.js +43 -0
- package/dist/core/validators/object/missing-key.js +42 -0
- package/dist/core/validators/object/no-empty-array-values.js +44 -0
- package/dist/core/validators/object/no-empty-object-values.js +44 -0
- package/dist/core/validators/object/no-null-values.js +44 -0
- package/dist/core/validators/object/no-undefined-values.js +44 -0
- package/dist/core/validators/object/non-empty-object.js +40 -0
- package/dist/core/validators/object/only-keys.js +43 -0
- package/dist/core/validators/object/plain-object.js +35 -0
- package/dist/core/validators/string/alpha-num.js +50 -0
- package/dist/core/validators/string/alpha.js +51 -0
- package/dist/core/validators/string/chars-equal.js +49 -0
- package/dist/core/validators/string/ends-with.js +50 -0
- package/dist/core/validators/string/is-ascii.js +53 -0
- package/dist/core/validators/string/is-printable.js +53 -0
- package/dist/core/validators/string/matches.js +50 -0
- package/dist/core/validators/string/max-length.js +50 -0
- package/dist/core/validators/string/min-length.js +50 -0
- package/dist/core/validators/string/no-lead-space.js +50 -0
- package/dist/core/validators/string/no-repeat-space.js +52 -0
- package/dist/core/validators/string/no-space.js +51 -0
- package/dist/core/validators/string/no-trail-space.js +50 -0
- package/dist/core/validators/string/non-empty.js +48 -0
- package/dist/core/validators/string/not-one-of.js +51 -0
- package/dist/core/validators/string/num-string.js +50 -0
- package/dist/core/validators/string/one-of.js +50 -0
- package/dist/core/validators/string/starts-with.js +50 -0
- package/dist/core/validators/string/string.js +39 -0
- package/dist/core/validators/string/trimmed.js +51 -0
- package/dist/index.js +26 -0
- package/dist/test.js +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Field Path | Utilities
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Small helper functions supporting FieldPath construction,
|
|
7
|
+
* parsing, and formatting.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
12
|
+
|* Dangerous Keys *|
|
|
13
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
14
|
+
/**
|
|
15
|
+
* Keys that must never appear in dotted notation.
|
|
16
|
+
*
|
|
17
|
+
* These properties interact with JavaScript’s prototype chain and are always
|
|
18
|
+
* forced into bracket‑notation to prevent prototype‑pollution vectors in
|
|
19
|
+
* formatting, parsing, and boundary evaluation.
|
|
20
|
+
*/
|
|
21
|
+
export const DANGEROUS_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
|
|
22
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
23
|
+
|* Escape Key *|
|
|
24
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
25
|
+
/**
|
|
26
|
+
* Escapes a key for bracket notation.
|
|
27
|
+
*
|
|
28
|
+
* Uses JSON string rules to preserve all characters exactly, ensuring keys
|
|
29
|
+
* round‑trip cleanly through user‑facing formatting and parsing.
|
|
30
|
+
*/
|
|
31
|
+
export function escapeKey(key) {
|
|
32
|
+
return JSON.stringify(key);
|
|
33
|
+
}
|
|
34
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
35
|
+
|* Is Dangerous Key *|
|
|
36
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
37
|
+
/**
|
|
38
|
+
* Checks whether a key is unsafe for dotted notation.
|
|
39
|
+
*
|
|
40
|
+
* Identifies prototype‑chain properties that must always be emitted in
|
|
41
|
+
* bracket‑notation to avoid prototype‑pollution vectors.
|
|
42
|
+
*/
|
|
43
|
+
export function isDangerousKey(key) {
|
|
44
|
+
return DANGEROUS_KEYS.has(key);
|
|
45
|
+
}
|
|
46
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
47
|
+
|* Is Root *|
|
|
48
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
49
|
+
/**
|
|
50
|
+
* Checks whether a FieldPath refers to the root.
|
|
51
|
+
*
|
|
52
|
+
* A path is the root when it contains no segments, representing the top‑level
|
|
53
|
+
* position in traversal, formatting, and boundary evaluation.
|
|
54
|
+
*/
|
|
55
|
+
export const isRoot = (path) => path.segments.length === 0;
|
|
56
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
57
|
+
|* Is Safe Key *|
|
|
58
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
59
|
+
/**
|
|
60
|
+
* Checks whether a key is safe for dotted notation.
|
|
61
|
+
*
|
|
62
|
+
* Rejects prototype‑chain properties and ensures the key matches JavaScript
|
|
63
|
+
* identifier rules, allowing it to appear unescaped in user‑facing paths.
|
|
64
|
+
*/
|
|
65
|
+
export function isSafeKey(key) {
|
|
66
|
+
if (DANGEROUS_KEYS.has(key))
|
|
67
|
+
return false;
|
|
68
|
+
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key);
|
|
69
|
+
}
|
|
70
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
71
|
+
|* Last Segment *|
|
|
72
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
73
|
+
/**
|
|
74
|
+
* Returns the final segment of a FieldPath.
|
|
75
|
+
*
|
|
76
|
+
* Useful when validators, scanners, or boundary logic need to inspect the
|
|
77
|
+
* current traversal position without mutating the path.
|
|
78
|
+
*/
|
|
79
|
+
export const lastSegment = (path) => path.segments[path.segments.length - 1];
|
|
80
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
81
|
+
|* Parent Path *|
|
|
82
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
83
|
+
/**
|
|
84
|
+
* Returns the parent of a FieldPath.
|
|
85
|
+
*
|
|
86
|
+
* Removes the final segment to move one level up in traversal. Root paths
|
|
87
|
+
* remain stable—slicing an empty path yields another empty path.
|
|
88
|
+
*/
|
|
89
|
+
export function parentPath(path) {
|
|
90
|
+
return { segments: path.segments.slice(0, -1) };
|
|
91
|
+
}
|
|
92
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
93
|
+
|* Path Equals *|
|
|
94
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
95
|
+
/**
|
|
96
|
+
* Checks whether two FieldPaths are structurally identical.
|
|
97
|
+
*
|
|
98
|
+
* Paths are equal only when they contain the same number of segments and each
|
|
99
|
+
* corresponding segment matches, ensuring deterministic behavior in diff,
|
|
100
|
+
* explain, and boundary evaluation.
|
|
101
|
+
*/
|
|
102
|
+
export function pathEquals(a, b) {
|
|
103
|
+
if (a.segments.length !== b.segments.length)
|
|
104
|
+
return false;
|
|
105
|
+
return a.segments.every((segment, i) => segmentsEqual(segment, b.segments[i]));
|
|
106
|
+
}
|
|
107
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
108
|
+
|* Path Starts With *|
|
|
109
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
110
|
+
/**
|
|
111
|
+
* Checks whether one FieldPath is a prefix of another.
|
|
112
|
+
*
|
|
113
|
+
* Path **a** starts with **b** when b has no more segments than a and each
|
|
114
|
+
* corresponding segment matches. Used by diff, explain, and boundary logic
|
|
115
|
+
* to determine whether a rule or change applies to a nested position.
|
|
116
|
+
*/
|
|
117
|
+
export function pathStartsWith(a, b) {
|
|
118
|
+
if (b.segments.length > a.segments.length)
|
|
119
|
+
return false;
|
|
120
|
+
return b.segments.every((segment, i) => segmentsEqual(segment, a.segments[i]));
|
|
121
|
+
}
|
|
122
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
123
|
+
|* Segments Equal *|
|
|
124
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
125
|
+
/**
|
|
126
|
+
* Checks whether two segments are structurally identical.
|
|
127
|
+
*
|
|
128
|
+
* Segments must share the same kind, and their key or index values must
|
|
129
|
+
* match exactly. This is the atomic comparison used by all path‑level
|
|
130
|
+
* equality and prefix checks.
|
|
131
|
+
*/
|
|
132
|
+
export const segmentsEqual = (a, b) => {
|
|
133
|
+
if (a.kind !== b.kind)
|
|
134
|
+
return false;
|
|
135
|
+
return a.kind === 'index'
|
|
136
|
+
? a.index === b.index
|
|
137
|
+
: a.key === b.key;
|
|
138
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Field Path | Walk
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Traversal helpers that walk JSON‑like data with FieldPath
|
|
7
|
+
* context.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { appendSegment, setIndex, setKey } from '../field-path';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Walk *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Recursively walks a JSON‑like value with FieldPath context.
|
|
17
|
+
*
|
|
18
|
+
* Visits the current node, then descends into arrays and plain objects,
|
|
19
|
+
* constructing child paths segment‑by‑segment. Prototype‑chain keys are
|
|
20
|
+
* skipped to avoid unsafe traversal during validation, scanning, and
|
|
21
|
+
* boundary evaluation.
|
|
22
|
+
*/
|
|
23
|
+
export async function walk(value, path, visit) {
|
|
24
|
+
await visit(value, path);
|
|
25
|
+
if (Array.isArray(value)) {
|
|
26
|
+
for (let i = 0; i < value.length; i++) {
|
|
27
|
+
const child = value[i];
|
|
28
|
+
const childPath = appendSegment(path, setIndex(i));
|
|
29
|
+
await walk(child, childPath, visit);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (value !== null && typeof value === 'object') {
|
|
34
|
+
const record = value;
|
|
35
|
+
for (const key of Object.keys(record)) {
|
|
36
|
+
if (!Object.prototype.hasOwnProperty.call(record, key))
|
|
37
|
+
continue;
|
|
38
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype')
|
|
39
|
+
continue;
|
|
40
|
+
const child = record[key];
|
|
41
|
+
const childPath = appendSegment(path, setKey(key));
|
|
42
|
+
await walk(child, childPath, visit);
|
|
43
|
+
}
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
48
|
+
|* Walk Array *|
|
|
49
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
50
|
+
/**
|
|
51
|
+
* Visits each element of an array with FieldPath context.
|
|
52
|
+
*
|
|
53
|
+
* Emits a child path for every index and invokes the visitor without
|
|
54
|
+
* descending further. Used internally by higher‑level walkers that
|
|
55
|
+
* control recursion and traversal strategy.
|
|
56
|
+
*/
|
|
57
|
+
export async function walkArray(value, path, visit) {
|
|
58
|
+
for (let index = 0; index < value.length; index++) {
|
|
59
|
+
await visit(value[index], appendSegment(path, setIndex(index)));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
63
|
+
|* Walk Object *|
|
|
64
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
65
|
+
/**
|
|
66
|
+
* Visits each own property of an object with FieldPath context.
|
|
67
|
+
*
|
|
68
|
+
* Emits a child path for every safe key and invokes the visitor without
|
|
69
|
+
* descending further. Prototype‑chain keys are skipped to avoid unsafe
|
|
70
|
+
* traversal during validation, scanning, and boundary evaluation.
|
|
71
|
+
*/
|
|
72
|
+
export async function walkObject(value, path, visit) {
|
|
73
|
+
for (const [key, child] of Object.entries(value)) {
|
|
74
|
+
if (!Object.prototype.hasOwnProperty.call(value, key))
|
|
75
|
+
continue;
|
|
76
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype')
|
|
77
|
+
continue;
|
|
78
|
+
await visit(child, appendSegment(path, setKey(key)));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Registry | Fluent
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Central registry of all built‑in validators and parsers.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
11
|
+
|* Parsers *|
|
|
12
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
13
|
+
import { parseArrayString, parseBigIntString, parseBinaryString, parseBooleanString, parseDurationString, parseHexString, parseIsoDateString, parseJsonString, parseNumericString, parseObjectString, parseOctalString, parseUrlString, } from './parsers';
|
|
14
|
+
import { parseIntegerString } from './parsers/parse-integer-string';
|
|
15
|
+
import { parseScientificNotationString } from './parsers/parse-scientific-notation-string';
|
|
16
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
17
|
+
|* Validators *|
|
|
18
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
19
|
+
import { alpha, alphaNum, array, arrayMaxItems, arrayMinItems, beforeEpoch, bigint, bigintEquals, bigintMax, bigintMin, bigintNegative, bigintNonNegative, bigintNonPositive, bigintPositive, bigintSafe, boolean, charsEqual, dateNowRequired, deepEquals, endsWith, excludes, finite, hasKey, hasUniqueItems, hasValue, includes, integer, isAscii, isCountryCode, isCurrencyCode, isDate, isEmail, isEmailStrict, isFalse, isFarFuture, isFuture, isIp, isNull, isNullOrUndefined, isPast, isPhone, isPhoneStrict, isPort, isPostalCode, isPrintable, isTrue, isUndefined, isUrl, isUuid, itemsEqual, keysEqual, lessThan, matches, max, maxLength, maxKeys, min, minLength, minKeys, missingKey, moreThan, negative, noEmptyArrayValues, noEmptyObjectValues, noEmptyStringItems, noNullItems, noNullValues, noUndefinedItems, noUndefinedValues, nonEmptyArray, nonEmptyObject, noLeadSpace, noRepeatSpace, noSpace, noTrailSpace, nonNegative, nonPositive, notAfter, notBefore, nonEmpty, notOneOf, notSparse, number, numString, oneOf, onlyKeys, plainObject, positive, safeInteger, sameDay, sameMonth, sameYear, startsWith, string, tooEarly, tooLate, trimmed, weekday, weekend, } from './validators';
|
|
20
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
21
|
+
|* Fluent API *|
|
|
22
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
23
|
+
/**
|
|
24
|
+
* Central registry of all built‑in Jane validators and parsers.
|
|
25
|
+
*
|
|
26
|
+
* This object provides a single, authoritative lookup table for every
|
|
27
|
+
* first‑party rule Jane ships with. Validators define how values are checked
|
|
28
|
+
* for correctness, while parsers convert raw input into structured forms.
|
|
29
|
+
* Keeping them together in one immutable registry ensures predictable
|
|
30
|
+
* resolution, consistent behavior across subsystems, and a stable surface
|
|
31
|
+
* for contributors extending or inspecting Jane’s rule set.
|
|
32
|
+
*/
|
|
33
|
+
export const janeRegistry = {
|
|
34
|
+
validators: {
|
|
35
|
+
alphaNum,
|
|
36
|
+
alpha,
|
|
37
|
+
array,
|
|
38
|
+
arrayMinItems,
|
|
39
|
+
arrayMaxItems,
|
|
40
|
+
beforeEpoch,
|
|
41
|
+
bigint,
|
|
42
|
+
bigintEquals,
|
|
43
|
+
bigintMax,
|
|
44
|
+
bigintMin,
|
|
45
|
+
bigintNegative,
|
|
46
|
+
bigintNonNegative,
|
|
47
|
+
bigintNonPositive,
|
|
48
|
+
bigintPositive,
|
|
49
|
+
bigintSafe,
|
|
50
|
+
boolean,
|
|
51
|
+
charsEqual,
|
|
52
|
+
dateNowRequired,
|
|
53
|
+
deepEquals,
|
|
54
|
+
endsWith,
|
|
55
|
+
excludes,
|
|
56
|
+
finite,
|
|
57
|
+
hasKey,
|
|
58
|
+
hasUniqueItems,
|
|
59
|
+
hasValue,
|
|
60
|
+
includes,
|
|
61
|
+
integer,
|
|
62
|
+
isAscii,
|
|
63
|
+
isCountryCode,
|
|
64
|
+
isCurrencyCode,
|
|
65
|
+
isDate,
|
|
66
|
+
isEmail,
|
|
67
|
+
isEmailStrict,
|
|
68
|
+
isFalse,
|
|
69
|
+
isFarFuture,
|
|
70
|
+
isFuture,
|
|
71
|
+
isIp,
|
|
72
|
+
isPast,
|
|
73
|
+
isPhone,
|
|
74
|
+
isPhoneStrict,
|
|
75
|
+
isPort,
|
|
76
|
+
isPostalCode,
|
|
77
|
+
isPrintable,
|
|
78
|
+
isNull,
|
|
79
|
+
isNullOrUndefined,
|
|
80
|
+
isTrue,
|
|
81
|
+
isUrl,
|
|
82
|
+
isUndefined,
|
|
83
|
+
isUuid,
|
|
84
|
+
itemsEqual,
|
|
85
|
+
keysEqual,
|
|
86
|
+
lessThan,
|
|
87
|
+
matches,
|
|
88
|
+
max,
|
|
89
|
+
maxKeys,
|
|
90
|
+
maxLength,
|
|
91
|
+
min,
|
|
92
|
+
minKeys,
|
|
93
|
+
minLength,
|
|
94
|
+
missingKey,
|
|
95
|
+
moreThan,
|
|
96
|
+
negative,
|
|
97
|
+
noEmptyArrayValues,
|
|
98
|
+
noEmptyObjectValues,
|
|
99
|
+
noEmptyStringItems,
|
|
100
|
+
noLeadSpace,
|
|
101
|
+
noNullItems,
|
|
102
|
+
noNullValues,
|
|
103
|
+
noRepeatSpace,
|
|
104
|
+
noSpace,
|
|
105
|
+
noTrailSpace,
|
|
106
|
+
noUndefinedItems,
|
|
107
|
+
noUndefinedValues,
|
|
108
|
+
nonEmpty,
|
|
109
|
+
nonEmptyArray,
|
|
110
|
+
nonEmptyObject,
|
|
111
|
+
nonNegative,
|
|
112
|
+
nonPositive,
|
|
113
|
+
notAfter,
|
|
114
|
+
notBefore,
|
|
115
|
+
notOneOf,
|
|
116
|
+
notSparse,
|
|
117
|
+
number,
|
|
118
|
+
numString,
|
|
119
|
+
oneOf,
|
|
120
|
+
onlyKeys,
|
|
121
|
+
plainObject,
|
|
122
|
+
positive,
|
|
123
|
+
safeInteger,
|
|
124
|
+
sameDay,
|
|
125
|
+
sameMonth,
|
|
126
|
+
sameYear,
|
|
127
|
+
startsWith,
|
|
128
|
+
string,
|
|
129
|
+
tooEarly,
|
|
130
|
+
tooLate,
|
|
131
|
+
trimmed,
|
|
132
|
+
weekday,
|
|
133
|
+
weekend,
|
|
134
|
+
},
|
|
135
|
+
parsers: {
|
|
136
|
+
numeric: parseNumericString,
|
|
137
|
+
integer: parseIntegerString,
|
|
138
|
+
boolean: parseBooleanString,
|
|
139
|
+
bigint: parseBigIntString,
|
|
140
|
+
hex: parseHexString,
|
|
141
|
+
binary: parseBinaryString,
|
|
142
|
+
octal: parseOctalString,
|
|
143
|
+
date: parseIsoDateString,
|
|
144
|
+
json: parseJsonString,
|
|
145
|
+
array: parseArrayString,
|
|
146
|
+
object: parseObjectString,
|
|
147
|
+
url: parseUrlString,
|
|
148
|
+
duration: parseDurationString,
|
|
149
|
+
scientific: parseScientificNotationString,
|
|
150
|
+
},
|
|
151
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Compact Sparse Array
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Removes sparse array holes while preserving all defined
|
|
7
|
+
* elements, producing a dense structure without altering the
|
|
8
|
+
* array’s semantic content.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import { normalizationEvent } from '../../pipeline';
|
|
13
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
14
|
+
|* Implementation *|
|
|
15
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
16
|
+
/**
|
|
17
|
+
* Compacts sparse arrays by removing empty slots while preserving all defined
|
|
18
|
+
* elements. This targets only structural holes—never values—ensuring arrays
|
|
19
|
+
* become dense without altering their semantic content.
|
|
20
|
+
*
|
|
21
|
+
* Useful for normalizing inputs that originate from user interfaces, spread
|
|
22
|
+
* operations, or partial constructions where sparse positions may appear
|
|
23
|
+
* unintentionally.
|
|
24
|
+
*/
|
|
25
|
+
export const compactSparseArray = (value, _mode, path) => {
|
|
26
|
+
if (!Array.isArray(value))
|
|
27
|
+
return [];
|
|
28
|
+
const compacted = value.filter(() => true); // removes holes only
|
|
29
|
+
if (compacted.length === value.length)
|
|
30
|
+
return [];
|
|
31
|
+
const event = normalizationEvent('info', 'array.now.compacted', path, 'Removed sparse array holes.', 'Empty array slots were removed.', { before: value, after: compacted });
|
|
32
|
+
return [
|
|
33
|
+
{
|
|
34
|
+
path,
|
|
35
|
+
nextValue: compacted,
|
|
36
|
+
lossy: 'lossless',
|
|
37
|
+
events: [event],
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Remove Empty String Items
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Removes empty string entries from arrays, eliminating
|
|
7
|
+
* placeholder or accidental text values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { normalizationEvent } from '../../pipeline';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Flattens nested arrays by a single level, simplifying structure while
|
|
17
|
+
* preserving item order. Useful for normalizing inputs where shallow nesting
|
|
18
|
+
* appears unintentionally.
|
|
19
|
+
*/
|
|
20
|
+
export const flattenOneLevel = (value, _mode, path) => {
|
|
21
|
+
if (!Array.isArray(value))
|
|
22
|
+
return [];
|
|
23
|
+
let changed = false;
|
|
24
|
+
const flattened = [];
|
|
25
|
+
for (const item of value) {
|
|
26
|
+
if (Array.isArray(item)) {
|
|
27
|
+
changed = true;
|
|
28
|
+
flattened.push(...item);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
flattened.push(item);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (!changed)
|
|
35
|
+
return [];
|
|
36
|
+
const event = normalizationEvent('info', 'array.now.flattened', path, 'Flattened nested arrays by one level.', 'Nested items were simplified.', { before: value, after: flattened });
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
path,
|
|
40
|
+
nextValue: flattened,
|
|
41
|
+
lossy: 'lossy',
|
|
42
|
+
events: [event],
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Remove Empty String Items
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Removes empty string entries from arrays, eliminating
|
|
7
|
+
* placeholder or accidental text values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { normalizationEvent } from '../../pipeline';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Removes empty string entries from arrays, eliminating placeholder or
|
|
17
|
+
* accidental text values while preserving all meaningful items.
|
|
18
|
+
*/
|
|
19
|
+
export const removeEmptyStringItems = (value, _mode, path) => {
|
|
20
|
+
if (!Array.isArray(value))
|
|
21
|
+
return [];
|
|
22
|
+
const filtered = value.filter((v) => v !== '');
|
|
23
|
+
if (filtered.length === value.length)
|
|
24
|
+
return [];
|
|
25
|
+
const event = normalizationEvent('info', 'array.without.empty-strings', path, 'Removed empty string items from array.', 'Empty text items were removed.', { before: value, after: filtered });
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
path,
|
|
29
|
+
nextValue: filtered,
|
|
30
|
+
lossy: 'lossy',
|
|
31
|
+
events: [event],
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Remove Null Items
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Filters out null entries from arrays, removing structurally
|
|
7
|
+
* empty items while preserving all defined values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { normalizationEvent } from '../../pipeline';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Filters out null entries from arrays, removing structurally empty items
|
|
17
|
+
* without altering the order or meaning of defined values.
|
|
18
|
+
*/
|
|
19
|
+
export const removeNullItems = (value, _mode, path) => {
|
|
20
|
+
if (!Array.isArray(value))
|
|
21
|
+
return [];
|
|
22
|
+
const filtered = value.filter((v) => v !== null);
|
|
23
|
+
if (filtered.length === value.length)
|
|
24
|
+
return [];
|
|
25
|
+
const event = normalizationEvent('info', 'array.without.null-items', path, 'Removed null items from array.', 'Empty items were removed.', { before: value, after: filtered });
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
path,
|
|
29
|
+
nextValue: filtered,
|
|
30
|
+
lossy: 'lossy',
|
|
31
|
+
events: [event],
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Remove Undefined Items
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Removes undefined entries from arrays, producing a cleaner
|
|
7
|
+
* and more predictable sequence of defined values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { normalizationEvent } from '../../pipeline';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Removes undefined entries from arrays, producing a cleaner and more
|
|
17
|
+
* predictable sequence of defined values.
|
|
18
|
+
*/
|
|
19
|
+
export const removeUndefinedItems = (value, _mode, path) => {
|
|
20
|
+
if (!Array.isArray(value))
|
|
21
|
+
return [];
|
|
22
|
+
const filtered = value.filter((v) => v !== undefined);
|
|
23
|
+
if (filtered.length === value.length)
|
|
24
|
+
return [];
|
|
25
|
+
const event = normalizationEvent('info', 'array.without.undefined-items', path, 'Removed undefined items from array.', 'Empty items were removed.', { before: value, after: filtered });
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
path,
|
|
29
|
+
nextValue: filtered,
|
|
30
|
+
lossy: 'lossy',
|
|
31
|
+
events: [event],
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Invalid Date To Undefined
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Converts invalid Date instances (timestamp NaN) to undefined,
|
|
7
|
+
* preventing malformed or unparsable date values from
|
|
8
|
+
* propagating through normalization.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import { normalizationEvent } from '../../pipeline';
|
|
13
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
14
|
+
|* Implementation *|
|
|
15
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
16
|
+
/**
|
|
17
|
+
* Converts invalid Date instances (timestamp NaN) to undefined, ensuring that
|
|
18
|
+
* malformed or unparsable date values do not propagate through normalization.
|
|
19
|
+
*/
|
|
20
|
+
export const invalidDateToUndefined = (value, _mode, path) => {
|
|
21
|
+
if (!(value instanceof Date))
|
|
22
|
+
return [];
|
|
23
|
+
// Invalid Date → timestamp is NaN
|
|
24
|
+
if (!Number.isNaN(value.getTime()))
|
|
25
|
+
return [];
|
|
26
|
+
const event = normalizationEvent('info', 'date.now.undefined', path, 'Converted an invalid Date instance to undefined.', 'Invalid date values were removed.', { before: value, after: undefined });
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
path,
|
|
30
|
+
nextValue: undefined,
|
|
31
|
+
lossy: 'lossy',
|
|
32
|
+
events: [event],
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Barrel File
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Re‑exports all normalization rules, providing a single,
|
|
7
|
+
* consolidated entry point for the normalization subsystem.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
12
|
+
|* Array Values *|
|
|
13
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
14
|
+
export { compactSparseArray } from './array/compact-sparse-array';
|
|
15
|
+
export { flattenOneLevel } from './array/flatten-one-level';
|
|
16
|
+
export { removeEmptyStringItems } from './array/remove-empty-string-items';
|
|
17
|
+
export { removeNullItems } from './array/remove-null-items';
|
|
18
|
+
export { removeUndefinedItems } from './array/remove-undefined-items';
|
|
19
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
20
|
+
|* Date Values *|
|
|
21
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
22
|
+
export { invalidDateToUndefined } from './date/invalid-date-to-undefined';
|
|
23
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
24
|
+
|* Number Values *|
|
|
25
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
26
|
+
export { infinityToUndefined } from './number/infinity-to-undefined';
|
|
27
|
+
export { nanToUndefined } from './number/nan-to-undefined';
|
|
28
|
+
export { normalizeNegativeZero } from './number/normalize-negative-zero';
|
|
29
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
30
|
+
|* Object Values *|
|
|
31
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
32
|
+
export { removeEmptyArrayKeys } from './object/remove-empty-array-keys';
|
|
33
|
+
export { removeEmptyObjectKeys } from './object/remove-empty-object-keys';
|
|
34
|
+
export { removeEmptyStringKeys } from './object/remove-empty-string-keys';
|
|
35
|
+
export { removeNullKeys } from './object/remove-null-keys';
|
|
36
|
+
export { removeUndefinedKeys } from './object/remove-undefined-keys';
|
|
37
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
38
|
+
|* String Values *|
|
|
39
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
40
|
+
export { collapseWhitespace } from './string/collapse-whitespace';
|
|
41
|
+
export { emptyToUndefined } from './string/empty-to-undefined';
|
|
42
|
+
export { trim } from './string/trim';
|
|
43
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
44
|
+
|* Registry *|
|
|
45
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
46
|
+
export { normalizationRuleRegistry } from './normalizer-register';
|