ts-data-forge 6.4.0 → 6.6.0
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/README.md +5 -3
- package/dist/array/impl/array-utils-element-access.d.mts +5 -5
- package/dist/array/impl/array-utils-element-access.mjs +4 -4
- package/dist/array/impl/array-utils-iterators.d.mts +1 -1
- package/dist/array/impl/array-utils-iterators.mjs +1 -1
- package/dist/array/impl/array-utils-modification.d.mts +4 -4
- package/dist/array/impl/array-utils-reducing-value.d.mts +5 -5
- package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.mjs +1 -0
- package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
- package/dist/array/impl/array-utils-search.d.mts +8 -8
- package/dist/array/impl/array-utils-set-op.d.mts.map +1 -1
- package/dist/array/impl/array-utils-set-op.mjs +3 -1
- package/dist/array/impl/array-utils-set-op.mjs.map +1 -1
- package/dist/array/impl/array-utils-size.d.mts +1 -1
- package/dist/array/impl/array-utils-size.mjs +1 -1
- package/dist/array/impl/array-utils-slice-clamped.d.mts +1 -1
- package/dist/array/impl/array-utils-slicing.d.mts +3 -3
- package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-validation.d.mts +7 -7
- package/dist/array/impl/array-utils-validation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-validation.mjs +22 -12
- package/dist/array/impl/array-utils-validation.mjs.map +1 -1
- package/dist/collections/imap-mapped.d.mts +5 -12
- package/dist/collections/imap-mapped.d.mts.map +1 -1
- package/dist/collections/imap-mapped.mjs.map +1 -1
- package/dist/collections/imap.d.mts +24 -28
- package/dist/collections/imap.d.mts.map +1 -1
- package/dist/collections/imap.mjs +1 -1
- package/dist/collections/imap.mjs.map +1 -1
- package/dist/collections/iset-mapped.d.mts +8 -14
- package/dist/collections/iset-mapped.d.mts.map +1 -1
- package/dist/collections/iset-mapped.mjs.map +1 -1
- package/dist/collections/iset.d.mts +9 -23
- package/dist/collections/iset.d.mts.map +1 -1
- package/dist/collections/iset.mjs +1 -0
- package/dist/collections/iset.mjs.map +1 -1
- package/dist/entry-point.mjs +1 -0
- package/dist/entry-point.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-is-optional.d.mts +1 -1
- package/dist/functional/optional/impl/optional-is-optional.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-is-optional.mjs +6 -5
- package/dist/functional/optional/impl/optional-is-optional.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-some.d.mts.map +1 -1
- package/dist/functional/optional/impl/optional-some.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-zip.d.mts +1 -1
- package/dist/functional/optional/impl/optional-zip.mjs +1 -1
- package/dist/functional/result/impl/result-err.d.mts.map +1 -1
- package/dist/functional/result/impl/result-err.mjs.map +1 -1
- package/dist/functional/result/impl/result-is-result.d.mts +1 -1
- package/dist/functional/result/impl/result-is-result.mjs +1 -1
- package/dist/functional/result/impl/result-ok.d.mts.map +1 -1
- package/dist/functional/result/impl/result-ok.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs +1 -0
- package/dist/functional/result/impl/result-unwrap-err-throw.mjs.map +1 -1
- package/dist/functional/result/impl/result-unwrap-throw.mjs +1 -0
- package/dist/functional/result/impl/result-unwrap-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-err.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-ok.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs +1 -0
- package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-warn.mjs.map +1 -1
- package/dist/guard/has-key.d.mts +3 -1
- package/dist/guard/has-key.d.mts.map +1 -1
- package/dist/guard/has-key.mjs +6 -2
- package/dist/guard/has-key.mjs.map +1 -1
- package/dist/guard/is-non-null-object.d.mts.map +1 -1
- package/dist/guard/is-non-null-object.mjs +3 -1
- package/dist/guard/is-non-null-object.mjs.map +1 -1
- package/dist/guard/is-record.d.mts +2 -2
- package/dist/guard/is-record.mjs +2 -2
- package/dist/guard/is-type.d.mts +15 -15
- package/dist/guard/is-type.mjs +15 -15
- package/dist/guard/key-is-in.d.mts.map +1 -1
- package/dist/guard/key-is-in.mjs +3 -1
- package/dist/guard/key-is-in.mjs.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/json/json.d.mts +3 -3
- package/dist/json/json.mjs +4 -3
- package/dist/json/json.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-safe-int.mjs +2 -2
- package/dist/number/branded-types/positive-safe-int.mjs +1 -1
- package/dist/number/branded-types/safe-int.mjs +2 -2
- package/dist/number/branded-types/safe-uint.mjs +1 -1
- package/dist/number/num.mjs +1 -1
- package/dist/object/object.d.mts +36 -8
- package/dist/object/object.d.mts.map +1 -1
- package/dist/object/object.mjs +28 -6
- package/dist/object/object.mjs.map +1 -1
- package/dist/others/fast-deep-equal.d.mts +8 -0
- package/dist/others/fast-deep-equal.d.mts.map +1 -0
- package/dist/others/fast-deep-equal.mjs +72 -0
- package/dist/others/fast-deep-equal.mjs.map +1 -0
- package/dist/others/index.d.mts +1 -0
- package/dist/others/index.d.mts.map +1 -1
- package/dist/others/index.mjs +1 -0
- package/dist/others/index.mjs.map +1 -1
- package/package.json +34 -29
- package/src/array/impl/array-utils-creation.test.mts +13 -10
- package/src/array/impl/array-utils-element-access.mts +5 -5
- package/src/array/impl/array-utils-element-access.test.mts +5 -5
- package/src/array/impl/array-utils-iterators.mts +1 -1
- package/src/array/impl/array-utils-iterators.test.mts +6 -6
- package/src/array/impl/array-utils-modification.mts +4 -4
- package/src/array/impl/array-utils-modification.test.mts +12 -12
- package/src/array/impl/array-utils-overload-type-error.test.mts +1 -1
- package/src/array/impl/array-utils-reducing-value.mts +6 -5
- package/src/array/impl/array-utils-reducing-value.test.mts +9 -9
- package/src/array/impl/array-utils-search.mts +8 -8
- package/src/array/impl/array-utils-search.test.mts +35 -35
- package/src/array/impl/array-utils-set-op.mts +1 -0
- package/src/array/impl/array-utils-set-op.test.mts +2 -2
- package/src/array/impl/array-utils-size.mts +1 -1
- package/src/array/impl/array-utils-size.test.mts +1 -1
- package/src/array/impl/array-utils-slice-clamped.mts +1 -1
- package/src/array/impl/array-utils-slice-clamped.test.mts +5 -5
- package/src/array/impl/array-utils-slicing.mts +3 -3
- package/src/array/impl/array-utils-slicing.test.mts +5 -5
- package/src/array/impl/array-utils-transformation.mts +1 -1
- package/src/array/impl/array-utils-transformation.test.mts +53 -53
- package/src/array/impl/array-utils-validation.mts +18 -10
- package/src/array/impl/array-utils-validation.test.mts +34 -29
- package/src/array/impl/array.test.mts +1 -1
- package/src/collections/imap-mapped.mts +4 -10
- package/src/collections/imap-mapped.test.mts +9 -9
- package/src/collections/imap.mts +24 -27
- package/src/collections/imap.test.mts +6 -6
- package/src/collections/iset-mapped.mts +12 -16
- package/src/collections/iset-mapped.test.mts +6 -6
- package/src/collections/iset.mts +14 -25
- package/src/collections/queue.test.mts +2 -1
- package/src/collections/stack.test.mts +3 -3
- package/src/functional/optional/impl/optional-is-optional.mts +6 -6
- package/src/functional/optional/impl/optional-some.mts +5 -4
- package/src/functional/optional/impl/optional-zip.mts +1 -1
- package/src/functional/result/impl/result-err.mts +5 -4
- package/src/functional/result/impl/result-is-result.mts +1 -1
- package/src/functional/result/impl/result-ok.mts +5 -4
- package/src/functional/result.test.mts +2 -2
- package/src/functional/ternary-result/impl/ternary-result-err.mts +5 -4
- package/src/functional/ternary-result/impl/ternary-result-is-ternary-result.mts +1 -1
- package/src/functional/ternary-result/impl/ternary-result-ok.mts +5 -4
- package/src/functional/ternary-result/impl/ternary-result-warn.mts +6 -5
- package/src/guard/has-key.mts +6 -2
- package/src/guard/is-error.test.mts +1 -1
- package/src/guard/is-non-empty-string.test.mts +1 -1
- package/src/guard/is-non-null-object.mts +1 -0
- package/src/guard/is-non-null-object.test.mts +4 -3
- package/src/guard/is-primitive.test.mts +1 -1
- package/src/guard/is-record.mts +2 -2
- package/src/guard/is-record.test.mts +2 -2
- package/src/guard/is-type.mts +15 -15
- package/src/guard/is-type.test.mts +2 -2
- package/src/guard/key-is-in.mts +3 -1
- package/src/json/json.mts +4 -3
- package/src/json/json.test.mts +20 -19
- package/src/number/branded-types/non-zero-safe-int.mts +2 -2
- package/src/number/branded-types/positive-safe-int.mts +1 -1
- package/src/number/branded-types/safe-int.mts +2 -2
- package/src/number/branded-types/safe-uint.mts +1 -1
- package/src/number/num.mts +1 -1
- package/src/object/object.mts +54 -8
- package/src/object/object.test.mts +70 -7
- package/src/others/cast-mutable.test.mts +3 -3
- package/src/others/cast-readonly.test.mts +10 -5
- package/src/others/fast-deep-equal.mts +98 -0
- package/src/others/fast-deep-equal.test.mts +771 -0
- package/src/others/index.mts +1 -0
- package/src/others/map-nullable.test.mts +8 -8
- package/src/others/memoize-function.test.mts +20 -8
- package/src/others/unknown-to-string.test.mts +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-err.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,GAAG,GAAI,KAAK,CAAC,CAAC,EAAG,OAAO,CAAC,KAAG,GAAG,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"result-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-err.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,GAAG,GAAI,KAAK,CAAC,CAAC,EAAG,OAAO,CAAC,KAAG,GAAG,CAAC,CAAC,CAIjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-err.mjs","sources":["../../../../src/functional/result/impl/result-err.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MACU,GAAG,GAAG,CAAW,KAAQ,
|
|
1
|
+
{"version":3,"file":"result-err.mjs","sources":["../../../../src/functional/result/impl/result-err.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MACU,GAAG,GAAG,CAAW,KAAQ,MACnC;AACC,IAAA,KAAK,EAAE,cAAc;IACrB,KAAK;AACN,CAAA;;;;"}
|
|
@@ -12,7 +12,7 @@ import { ErrTypeTagName, OkTypeTagName } from './tag.mjs';
|
|
|
12
12
|
*
|
|
13
13
|
* const errValue = Result.err(new Error('failure'));
|
|
14
14
|
*
|
|
15
|
-
* const notResult = { $$tag: 'ts-data-forge::Result.ok' };
|
|
15
|
+
* const notResult = { $$tag: 'ts-data-forge::Result.ok' } as const;
|
|
16
16
|
*
|
|
17
17
|
* assert.isTrue(Result.isResult(okValue));
|
|
18
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-ok.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-ok.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,EAAE,GAAI,KAAK,CAAC,CAAC,EAAG,OAAO,CAAC,KAAG,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"result-ok.d.mts","sourceRoot":"","sources":["../../../../src/functional/result/impl/result-ok.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,EAAE,GAAI,KAAK,CAAC,CAAC,EAAG,OAAO,CAAC,KAAG,EAAE,CAAC,CAAC,CAI/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-ok.mjs","sources":["../../../../src/functional/result/impl/result-ok.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MACU,EAAE,GAAG,CAAW,KAAQ,
|
|
1
|
+
{"version":3,"file":"result-ok.mjs","sources":["../../../../src/functional/result/impl/result-ok.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MACU,EAAE,GAAG,CAAW,KAAQ,MAClC;AACC,IAAA,KAAK,EAAE,aAAa;IACpB,KAAK;AACN,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-unwrap-err-throw.mjs","sources":["../../../../src/functional/result/impl/result-unwrap-err-throw.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"result-unwrap-err-throw.mjs","sources":["../../../../src/functional/result/impl/result-unwrap-err-throw.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACI,MAAM,cAAc,GAAG,CAC5B,MAAS,EACT,KAAA,GAAoC,eAAe,KACnC;AAChB,IAAA,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE;;QAEjB,OAAO,MAAM,CAAC,KAAqB;IACrC;AAEA,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE;AAClC,QAAA,0BAA0B,EAAE,IAAI;AAChC,QAAA,2BAA2B,EAAE,KAAK;AACnC,KAAA,CAAC;AAEF,IAAA,MAAM,IAAI,KAAK,CACb,CAAA,qBAAA,EAAwB,OAAO,KAAK,KAAK;;AAEvC,IAAA,MAAM,CAAC,KAAoB,CAC5B,CAAA,CAAE,CACJ;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-unwrap-throw.mjs","sources":["../../../../src/functional/result/impl/result-unwrap-throw.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"result-unwrap-throw.mjs","sources":["../../../../src/functional/result/impl/result-unwrap-throw.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACI,MAAM,WAAW,GAAG,CACzB,MAAS,EACT,KAAA,GAAqC,eAAe,KACrC;AACf,IAAA,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE;;QAEjB,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAqB,CAAC,CAAC;IACtD;;IAGA,OAAO,MAAM,CAAC,KAAoB;AACpC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-err.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,GAAG,GAAI,KAAK,CAAC,CAAC,EAAG,OAAO,CAAC,KAAG,UAAU,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"ternary-result-err.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-err.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,GAAG,GAAI,KAAK,CAAC,CAAC,EAAG,OAAO,CAAC,KAAG,UAAU,CAAC,CAAC,CAIxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-err.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-err.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;AAYG;MACU,GAAG,GAAG,CAAW,KAAQ,
|
|
1
|
+
{"version":3,"file":"ternary-result-err.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-err.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;AAYG;MACU,GAAG,GAAG,CAAW,KAAQ,MACnC;AACC,IAAA,KAAK,EAAE,cAAc;IACrB,KAAK;AACN,CAAA;;;;"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* const warnValue = TernaryResult.warn('done', 'retry later');
|
|
10
10
|
*
|
|
11
|
-
* const notResult = { $$tag: 'ts-data-forge::Result.ok' };
|
|
11
|
+
* const notResult = { $$tag: 'ts-data-forge::Result.ok' } as const;
|
|
12
12
|
*
|
|
13
13
|
* assert.isTrue(TernaryResult.isTernaryResult(okValue));
|
|
14
14
|
*
|
|
@@ -12,7 +12,7 @@ import { WarnTypeTagName, OkTypeTagName, ErrTypeTagName } from './tag.mjs';
|
|
|
12
12
|
*
|
|
13
13
|
* const warnValue = TernaryResult.warn('done', 'retry later');
|
|
14
14
|
*
|
|
15
|
-
* const notResult = { $$tag: 'ts-data-forge::Result.ok' };
|
|
15
|
+
* const notResult = { $$tag: 'ts-data-forge::Result.ok' } as const;
|
|
16
16
|
*
|
|
17
17
|
* assert.isTrue(TernaryResult.isTernaryResult(okValue));
|
|
18
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-ok.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-ok.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,EAAE,GAAI,KAAK,CAAC,CAAC,EAAG,OAAO,CAAC,KAAG,SAAS,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"ternary-result-ok.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-ok.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,EAAE,GAAI,KAAK,CAAC,CAAC,EAAG,OAAO,CAAC,KAAG,SAAS,CAAC,CAAC,CAItC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-ok.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-ok.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;AAaG;MACU,EAAE,GAAG,CAAW,KAAQ,
|
|
1
|
+
{"version":3,"file":"ternary-result-ok.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-ok.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;AAaG;MACU,EAAE,GAAG,CAAW,KAAQ,MAClC;AACC,IAAA,KAAK,EAAE,aAAa;IACpB,KAAK;AACN,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-unwrap-err-throw.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ternary-result-unwrap-err-throw.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAMA;;;;;;;;;;;;;;;AAeG;AACI,MAAM,cAAc,GAAG,CAC5B,MAAS,EACT,KAAA,GAAwD,eAAe,KACvD;AAChB,IAAA,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE;;QAEjB,OAAO,MAAM,CAAC,KAAqB;IACrC;IAEA,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;AAEzC,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM;AAC3B;AACG,YAAA,MAAM,CAAC;AACV;YACG,MAAM,CAAC,KAAoD;AAEhE,IAAA,MAAM,IAAI,KAAK,CAAC,CAAA,qBAAA,EAAwB,OAAO,CAAA,EAAA,EAAK,KAAK,CAAC,OAAO,CAAC,CAAA,CAAE,CAAC;AACvE;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-unwrap-throw.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-throw.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ternary-result-unwrap-throw.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-throw.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAKA;;;;;;;;;;;;;;;;AAgBG;AACI,MAAM,WAAW,GAAG,CACzB,MAAS,EACT,KAAA,GAAyD,eAAe,KACzD;AACf,IAAA,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE;AACjB,QAAA,MAAM,IAAI,KAAK,CACb,CAAA,yBAAA,EAA4B,KAAK;;AAE/B,QAAA,MAAM,CAAC,KAAqB,CAC7B,CAAA,CAAE,CACJ;IACH;AAEA,IAAA,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE;AAClB,QAAA,MAAM,IAAI,KAAK,CACb,CAAA,0BAAA,EAA6B,KAAK;;AAEhC,QAAA,MAAM,CAAC,OAAwB,CAChC,CAAA,CAAE,CACJ;IACH;;IAGA,OAAO,MAAM,CAAC,KAAoB;AACpC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-unwrap-warn-throw.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ternary-result-unwrap-warn-throw.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAKA;;;;;;;;;;;;;;;AAeG;AACI,MAAM,eAAe,GAAG,CAC7B,MAAS,EACT,KAAA,GAAuD,eAAe,KACrD;AACjB,IAAA,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE;;QAElB,OAAO,MAAM,CAAC,OAAwB;IACxC;IAEA,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;AAEzC,IAAA,MAAM,IAAI,KAAK,CACb,CAAA,sBAAA,EAAyB,OAAO,KAAK,KAAK;;AAExC,IAAA,MAAM,CAAC,KAAmC,CAC3C,CAAA,CAAE,CACJ;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-warn.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-warn.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,IAAI,GAAI,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EACnC,OAAO,CAAC,EACR,SAAS,CAAC,KACT,WAAW,CAAC,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"ternary-result-warn.d.mts","sourceRoot":"","sources":["../../../../src/functional/ternary-result/impl/ternary-result-warn.mts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,IAAI,GAAI,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EACnC,OAAO,CAAC,EACR,SAAS,CAAC,KACT,WAAW,CAAC,CAAC,EAAE,CAAC,CAKN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ternary-result-warn.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-warn.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;AAeG;AACI,MAAM,IAAI,GAAG,CAClB,KAAQ,EACR,OAAU,
|
|
1
|
+
{"version":3,"file":"ternary-result-warn.mjs","sources":["../../../../src/functional/ternary-result/impl/ternary-result-warn.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;AAeG;AACI,MAAM,IAAI,GAAG,CAClB,KAAQ,EACR,OAAU,MAET;AACC,IAAA,KAAK,EAAE,eAAe;IACtB,KAAK;IACL,OAAO;AACR,CAAA;;;;"}
|
package/dist/guard/has-key.d.mts
CHANGED
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
* @example
|
|
18
18
|
*
|
|
19
19
|
* ```ts
|
|
20
|
-
* const maybeUser: Readonly<{ id?: number; name?: string }> = {
|
|
20
|
+
* const maybeUser: Readonly<{ id?: number; name?: string }> = {
|
|
21
|
+
* id: 42,
|
|
22
|
+
* } as const;
|
|
21
23
|
*
|
|
22
24
|
* if (hasKey(maybeUser, 'id')) {
|
|
23
25
|
* // `maybeUser` is now known to have an `id` property.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has-key.d.mts","sourceRoot":"","sources":["../../src/guard/has-key.mts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"has-key.d.mts","sourceRoot":"","sources":["../../src/guard/has-key.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,MAAM,GACjB,KAAK,CAAC,CAAC,SAAS,aAAa,EAC7B,KAAK,CAAC,CAAC,SAAS,WAAW,EAE3B,KAAK,CAAC,EACN,KAAK,CAAC,KACL,GAAG,IAAI,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAEN,CAAC;AAE1B;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,CAC1B,CAAC,SAAS,aAAa,EACvB,CAAC,SAAS,WAAW,IACnB,CAAC,SAAS,CAAC,GACX,CAAC,SAAS,MAAM,CAAC,GACf,MAAM,SAAS,MAAM,CAAC,GACpB,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GACjC,MAAM,SAAS,MAAM,CAAC,GACpB,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GACjC,MAAM,SAAS,MAAM,CAAC,GACpB,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GACjC,CAAC,GACP,KAAK,GACP,KAAK,CAAC"}
|
package/dist/guard/has-key.mjs
CHANGED
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
* @example
|
|
18
18
|
*
|
|
19
19
|
* ```ts
|
|
20
|
-
* const maybeUser: Readonly<{ id?: number; name?: string }> = {
|
|
20
|
+
* const maybeUser: Readonly<{ id?: number; name?: string }> = {
|
|
21
|
+
* id: 42,
|
|
22
|
+
* } as const;
|
|
21
23
|
*
|
|
22
24
|
* if (hasKey(maybeUser, 'id')) {
|
|
23
25
|
* // `maybeUser` is now known to have an `id` property.
|
|
@@ -37,7 +39,9 @@
|
|
|
37
39
|
* guarantee the key exists.
|
|
38
40
|
* @see {@link keyIsIn} - Similar function that narrows the key type instead of the object type
|
|
39
41
|
*/
|
|
40
|
-
const hasKey = (obj, key) =>
|
|
42
|
+
const hasKey = (obj, key) =>
|
|
43
|
+
// eslint-disable-next-line ts-data-forge/prefer-is-record-and-has-key
|
|
44
|
+
Object.hasOwn(obj, key);
|
|
41
45
|
|
|
42
46
|
export { hasKey };
|
|
43
47
|
//# sourceMappingURL=has-key.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has-key.mjs","sources":["../../src/guard/has-key.mts"],"sourcesContent":[null],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"has-key.mjs","sources":["../../src/guard/has-key.mts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCG;MACU,MAAM,GAAG,CAIpB,GAAM,EACN,GAAM;AAEN;AACA,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-non-null-object.d.mts","sourceRoot":"","sources":["../../src/guard/is-non-null-object.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,eAAO,MAAM,eAAe,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"is-non-null-object.d.mts","sourceRoot":"","sources":["../../src/guard/is-non-null-object.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,eAAO,MAAM,eAAe,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,MAEb,CAAC"}
|
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
* @see {@link isRecord} - For checking plain objects specifically (excludes arrays)
|
|
33
33
|
*/
|
|
34
34
|
// eslint-disable-next-line @typescript-eslint/no-restricted-types
|
|
35
|
-
const isNonNullObject = (u) =>
|
|
35
|
+
const isNonNullObject = (u) =>
|
|
36
|
+
// eslint-disable-next-line ts-data-forge/prefer-is-non-null-object
|
|
37
|
+
typeof u === 'object' && u !== null;
|
|
36
38
|
|
|
37
39
|
export { isNonNullObject };
|
|
38
40
|
//# sourceMappingURL=is-non-null-object.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-non-null-object.mjs","sources":["../../src/guard/is-non-null-object.mts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCG;AACH;AACO,MAAM,eAAe,GAAG,CAAC,CAAU,
|
|
1
|
+
{"version":3,"file":"is-non-null-object.mjs","sources":["../../src/guard/is-non-null-object.mts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCG;AACH;AACO,MAAM,eAAe,GAAG,CAAC,CAAU;AACxC;AACA,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK;;;;"}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @example
|
|
24
24
|
*
|
|
25
25
|
* ```ts
|
|
26
|
-
* const entries: readonly unknown[] = [{ id: 1 }, 'str', 0, null];
|
|
26
|
+
* const entries: readonly unknown[] = [{ id: 1 }, 'str', 0, null] as const;
|
|
27
27
|
*
|
|
28
28
|
* const records = entries.filter(isRecord);
|
|
29
29
|
*
|
|
@@ -55,7 +55,7 @@ export declare const isRecord: (u: unknown) => u is UnknownRecord;
|
|
|
55
55
|
*
|
|
56
56
|
* @example
|
|
57
57
|
* ```ts
|
|
58
|
-
* const obj: unknown = { foo: 1 };
|
|
58
|
+
* const obj: unknown = { foo: 1 } as const;
|
|
59
59
|
*
|
|
60
60
|
* if (isMutableRecord(obj)) {
|
|
61
61
|
* obj['bar'] = 2; // Safe: obj is now known to be a mutable record
|
package/dist/guard/is-record.mjs
CHANGED
|
@@ -25,7 +25,7 @@ import { isNonNullObject } from './is-non-null-object.mjs';
|
|
|
25
25
|
* @example
|
|
26
26
|
*
|
|
27
27
|
* ```ts
|
|
28
|
-
* const entries: readonly unknown[] = [{ id: 1 }, 'str', 0, null];
|
|
28
|
+
* const entries: readonly unknown[] = [{ id: 1 }, 'str', 0, null] as const;
|
|
29
29
|
*
|
|
30
30
|
* const records = entries.filter(isRecord);
|
|
31
31
|
*
|
|
@@ -57,7 +57,7 @@ const isRecord = (u) => isNonNullObject(u);
|
|
|
57
57
|
*
|
|
58
58
|
* @example
|
|
59
59
|
* ```ts
|
|
60
|
-
* const obj: unknown = { foo: 1 };
|
|
60
|
+
* const obj: unknown = { foo: 1 } as const;
|
|
61
61
|
*
|
|
62
62
|
* if (isMutableRecord(obj)) {
|
|
63
63
|
* obj['bar'] = 2; // Safe: obj is now known to be a mutable record
|
package/dist/guard/is-type.d.mts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @example
|
|
10
10
|
*
|
|
11
11
|
* ```ts
|
|
12
|
-
* const values: readonly (number | undefined)[] = [1, undefined, 2];
|
|
12
|
+
* const values: readonly (number | undefined)[] = [1, undefined, 2] as const;
|
|
13
13
|
*
|
|
14
14
|
* const undefinedValues = values.filter(isUndefined);
|
|
15
15
|
*
|
|
@@ -33,7 +33,7 @@ export declare const isUndefined: (u: unknown) => u is undefined;
|
|
|
33
33
|
* @example
|
|
34
34
|
*
|
|
35
35
|
* ```ts
|
|
36
|
-
* const values: readonly (number | undefined)[] = [1, undefined, 2];
|
|
36
|
+
* const values: readonly (number | undefined)[] = [1, undefined, 2] as const;
|
|
37
37
|
*
|
|
38
38
|
* const definedValues = values.filter(isNotUndefined);
|
|
39
39
|
*
|
|
@@ -57,7 +57,7 @@ export declare const isNotUndefined: <T>(u: T) => u is RelaxedExclude<T, undefin
|
|
|
57
57
|
* @example
|
|
58
58
|
*
|
|
59
59
|
* ```ts
|
|
60
|
-
* const flags: readonly unknown[] = [true, 'no', false];
|
|
60
|
+
* const flags: readonly unknown[] = [true, 'no', false] as const;
|
|
61
61
|
*
|
|
62
62
|
* const booleans = flags.filter(isBoolean);
|
|
63
63
|
*
|
|
@@ -80,7 +80,7 @@ export declare const isBoolean: (u: unknown) => u is boolean;
|
|
|
80
80
|
* @example
|
|
81
81
|
*
|
|
82
82
|
* ```ts
|
|
83
|
-
* const flags: readonly unknown[] = [true, 'no', false];
|
|
83
|
+
* const flags: readonly unknown[] = [true, 'no', false] as const;
|
|
84
84
|
*
|
|
85
85
|
* const nonBooleans = flags.filter(isNotBoolean);
|
|
86
86
|
*
|
|
@@ -105,7 +105,7 @@ export declare const isNotBoolean: <T>(u: T) => u is RelaxedExclude<T, boolean>;
|
|
|
105
105
|
* @example
|
|
106
106
|
*
|
|
107
107
|
* ```ts
|
|
108
|
-
* const mixed: readonly unknown[] = [1, '2', 3];
|
|
108
|
+
* const mixed: readonly unknown[] = [1, '2', 3] as const;
|
|
109
109
|
*
|
|
110
110
|
* const numbers = mixed.filter(isNumber);
|
|
111
111
|
*
|
|
@@ -128,7 +128,7 @@ export declare const isNumber: (u: unknown) => u is number;
|
|
|
128
128
|
* @example
|
|
129
129
|
*
|
|
130
130
|
* ```ts
|
|
131
|
-
* const mixed: readonly unknown[] = [1, '2', 3];
|
|
131
|
+
* const mixed: readonly unknown[] = [1, '2', 3] as const;
|
|
132
132
|
*
|
|
133
133
|
* const nonNumbers = mixed.filter(isNotNumber);
|
|
134
134
|
*
|
|
@@ -152,7 +152,7 @@ export declare const isNotNumber: <T>(u: T) => u is RelaxedExclude<T, number>;
|
|
|
152
152
|
* @example
|
|
153
153
|
*
|
|
154
154
|
* ```ts
|
|
155
|
-
* const values: readonly unknown[] = [1n, 2, 3n];
|
|
155
|
+
* const values: readonly unknown[] = [1n, 2, 3n] as const;
|
|
156
156
|
*
|
|
157
157
|
* const bigints = values.filter(isBigint);
|
|
158
158
|
*
|
|
@@ -175,7 +175,7 @@ export declare const isBigint: (u: unknown) => u is bigint;
|
|
|
175
175
|
* @example
|
|
176
176
|
*
|
|
177
177
|
* ```ts
|
|
178
|
-
* const values: readonly unknown[] = [1n, 2, 3n];
|
|
178
|
+
* const values: readonly unknown[] = [1n, 2, 3n] as const;
|
|
179
179
|
*
|
|
180
180
|
* const nonBigints = values.filter(isNotBigint);
|
|
181
181
|
*
|
|
@@ -200,7 +200,7 @@ export declare const isNotBigint: <T>(u: T) => u is RelaxedExclude<T, bigint>;
|
|
|
200
200
|
* @example
|
|
201
201
|
*
|
|
202
202
|
* ```ts
|
|
203
|
-
* const values: readonly unknown[] = ['Ada', 42, 'Lovelace'];
|
|
203
|
+
* const values: readonly unknown[] = ['Ada', 42, 'Lovelace'] as const;
|
|
204
204
|
*
|
|
205
205
|
* const strings = values.filter(isString);
|
|
206
206
|
*
|
|
@@ -223,7 +223,7 @@ export declare const isString: (u: unknown) => u is string;
|
|
|
223
223
|
* @example
|
|
224
224
|
*
|
|
225
225
|
* ```ts
|
|
226
|
-
* const values: readonly unknown[] = ['Ada', 42, 'Lovelace'];
|
|
226
|
+
* const values: readonly unknown[] = ['Ada', 42, 'Lovelace'] as const;
|
|
227
227
|
*
|
|
228
228
|
* const nonStrings = values.filter(isNotString);
|
|
229
229
|
*
|
|
@@ -251,7 +251,7 @@ export declare const isNotString: <T>(u: T) => u is RelaxedExclude<T, string>;
|
|
|
251
251
|
*
|
|
252
252
|
* const shared = Symbol.for('shared');
|
|
253
253
|
*
|
|
254
|
-
* const tokens: readonly unknown[] = [id, 'shared', shared];
|
|
254
|
+
* const tokens: readonly unknown[] = [id, 'shared', shared] as const;
|
|
255
255
|
*
|
|
256
256
|
* const symbols = tokens.filter(isSymbol);
|
|
257
257
|
*
|
|
@@ -276,7 +276,7 @@ export declare const isSymbol: (u: unknown) => u is symbol;
|
|
|
276
276
|
* ```ts
|
|
277
277
|
* const id = Symbol('id');
|
|
278
278
|
*
|
|
279
|
-
* const tokens: readonly unknown[] = [id, 'shared'];
|
|
279
|
+
* const tokens: readonly unknown[] = [id, 'shared'] as const;
|
|
280
280
|
*
|
|
281
281
|
* const nonSymbols = tokens.filter(isNotSymbol);
|
|
282
282
|
*
|
|
@@ -324,7 +324,7 @@ export declare const isNull: (u: unknown) => u is null;
|
|
|
324
324
|
* @example
|
|
325
325
|
*
|
|
326
326
|
* ```ts
|
|
327
|
-
* const values: readonly (number | null)[] = [null, 5];
|
|
327
|
+
* const values: readonly (number | null)[] = [null, 5] as const;
|
|
328
328
|
*
|
|
329
329
|
* const nonNullValues = values.filter(isNotNull);
|
|
330
330
|
*
|
|
@@ -356,7 +356,7 @@ export declare const isNotNull: <T>(u: T | null) => u is T;
|
|
|
356
356
|
* 'Ada',
|
|
357
357
|
* null,
|
|
358
358
|
* undefined,
|
|
359
|
-
* ];
|
|
359
|
+
* ] as const;
|
|
360
360
|
*
|
|
361
361
|
* const nullishValues = values.filter(isNullish);
|
|
362
362
|
*
|
|
@@ -388,7 +388,7 @@ export declare const isNullish: (u: unknown) => u is null | undefined;
|
|
|
388
388
|
* 'Ada',
|
|
389
389
|
* null,
|
|
390
390
|
* undefined,
|
|
391
|
-
* ];
|
|
391
|
+
* ] as const;
|
|
392
392
|
*
|
|
393
393
|
* const definedValues = values.filter(isNonNullish);
|
|
394
394
|
*
|
package/dist/guard/is-type.mjs
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @example
|
|
10
10
|
*
|
|
11
11
|
* ```ts
|
|
12
|
-
* const values: readonly (number | undefined)[] = [1, undefined, 2];
|
|
12
|
+
* const values: readonly (number | undefined)[] = [1, undefined, 2] as const;
|
|
13
13
|
*
|
|
14
14
|
* const undefinedValues = values.filter(isUndefined);
|
|
15
15
|
*
|
|
@@ -33,7 +33,7 @@ const isUndefined = (u) => u === undefined;
|
|
|
33
33
|
* @example
|
|
34
34
|
*
|
|
35
35
|
* ```ts
|
|
36
|
-
* const values: readonly (number | undefined)[] = [1, undefined, 2];
|
|
36
|
+
* const values: readonly (number | undefined)[] = [1, undefined, 2] as const;
|
|
37
37
|
*
|
|
38
38
|
* const definedValues = values.filter(isNotUndefined);
|
|
39
39
|
*
|
|
@@ -57,7 +57,7 @@ const isNotUndefined = (u) => u !== undefined;
|
|
|
57
57
|
* @example
|
|
58
58
|
*
|
|
59
59
|
* ```ts
|
|
60
|
-
* const flags: readonly unknown[] = [true, 'no', false];
|
|
60
|
+
* const flags: readonly unknown[] = [true, 'no', false] as const;
|
|
61
61
|
*
|
|
62
62
|
* const booleans = flags.filter(isBoolean);
|
|
63
63
|
*
|
|
@@ -80,7 +80,7 @@ const isBoolean = (u) => typeof u === 'boolean';
|
|
|
80
80
|
* @example
|
|
81
81
|
*
|
|
82
82
|
* ```ts
|
|
83
|
-
* const flags: readonly unknown[] = [true, 'no', false];
|
|
83
|
+
* const flags: readonly unknown[] = [true, 'no', false] as const;
|
|
84
84
|
*
|
|
85
85
|
* const nonBooleans = flags.filter(isNotBoolean);
|
|
86
86
|
*
|
|
@@ -105,7 +105,7 @@ const isNotBoolean = (u) => typeof u !== 'boolean';
|
|
|
105
105
|
* @example
|
|
106
106
|
*
|
|
107
107
|
* ```ts
|
|
108
|
-
* const mixed: readonly unknown[] = [1, '2', 3];
|
|
108
|
+
* const mixed: readonly unknown[] = [1, '2', 3] as const;
|
|
109
109
|
*
|
|
110
110
|
* const numbers = mixed.filter(isNumber);
|
|
111
111
|
*
|
|
@@ -128,7 +128,7 @@ const isNumber = (u) => typeof u === 'number';
|
|
|
128
128
|
* @example
|
|
129
129
|
*
|
|
130
130
|
* ```ts
|
|
131
|
-
* const mixed: readonly unknown[] = [1, '2', 3];
|
|
131
|
+
* const mixed: readonly unknown[] = [1, '2', 3] as const;
|
|
132
132
|
*
|
|
133
133
|
* const nonNumbers = mixed.filter(isNotNumber);
|
|
134
134
|
*
|
|
@@ -152,7 +152,7 @@ const isNotNumber = (u) => typeof u !== 'number';
|
|
|
152
152
|
* @example
|
|
153
153
|
*
|
|
154
154
|
* ```ts
|
|
155
|
-
* const values: readonly unknown[] = [1n, 2, 3n];
|
|
155
|
+
* const values: readonly unknown[] = [1n, 2, 3n] as const;
|
|
156
156
|
*
|
|
157
157
|
* const bigints = values.filter(isBigint);
|
|
158
158
|
*
|
|
@@ -175,7 +175,7 @@ const isBigint = (u) => typeof u === 'bigint';
|
|
|
175
175
|
* @example
|
|
176
176
|
*
|
|
177
177
|
* ```ts
|
|
178
|
-
* const values: readonly unknown[] = [1n, 2, 3n];
|
|
178
|
+
* const values: readonly unknown[] = [1n, 2, 3n] as const;
|
|
179
179
|
*
|
|
180
180
|
* const nonBigints = values.filter(isNotBigint);
|
|
181
181
|
*
|
|
@@ -200,7 +200,7 @@ const isNotBigint = (u) => typeof u !== 'bigint';
|
|
|
200
200
|
* @example
|
|
201
201
|
*
|
|
202
202
|
* ```ts
|
|
203
|
-
* const values: readonly unknown[] = ['Ada', 42, 'Lovelace'];
|
|
203
|
+
* const values: readonly unknown[] = ['Ada', 42, 'Lovelace'] as const;
|
|
204
204
|
*
|
|
205
205
|
* const strings = values.filter(isString);
|
|
206
206
|
*
|
|
@@ -223,7 +223,7 @@ const isString = (u) => typeof u === 'string';
|
|
|
223
223
|
* @example
|
|
224
224
|
*
|
|
225
225
|
* ```ts
|
|
226
|
-
* const values: readonly unknown[] = ['Ada', 42, 'Lovelace'];
|
|
226
|
+
* const values: readonly unknown[] = ['Ada', 42, 'Lovelace'] as const;
|
|
227
227
|
*
|
|
228
228
|
* const nonStrings = values.filter(isNotString);
|
|
229
229
|
*
|
|
@@ -251,7 +251,7 @@ const isNotString = (u) => typeof u !== 'string';
|
|
|
251
251
|
*
|
|
252
252
|
* const shared = Symbol.for('shared');
|
|
253
253
|
*
|
|
254
|
-
* const tokens: readonly unknown[] = [id, 'shared', shared];
|
|
254
|
+
* const tokens: readonly unknown[] = [id, 'shared', shared] as const;
|
|
255
255
|
*
|
|
256
256
|
* const symbols = tokens.filter(isSymbol);
|
|
257
257
|
*
|
|
@@ -276,7 +276,7 @@ const isSymbol = (u) => typeof u === 'symbol';
|
|
|
276
276
|
* ```ts
|
|
277
277
|
* const id = Symbol('id');
|
|
278
278
|
*
|
|
279
|
-
* const tokens: readonly unknown[] = [id, 'shared'];
|
|
279
|
+
* const tokens: readonly unknown[] = [id, 'shared'] as const;
|
|
280
280
|
*
|
|
281
281
|
* const nonSymbols = tokens.filter(isNotSymbol);
|
|
282
282
|
*
|
|
@@ -324,7 +324,7 @@ const isNull = (u) => u === null;
|
|
|
324
324
|
* @example
|
|
325
325
|
*
|
|
326
326
|
* ```ts
|
|
327
|
-
* const values: readonly (number | null)[] = [null, 5];
|
|
327
|
+
* const values: readonly (number | null)[] = [null, 5] as const;
|
|
328
328
|
*
|
|
329
329
|
* const nonNullValues = values.filter(isNotNull);
|
|
330
330
|
*
|
|
@@ -356,7 +356,7 @@ const isNotNull = (u) => u !== null;
|
|
|
356
356
|
* 'Ada',
|
|
357
357
|
* null,
|
|
358
358
|
* undefined,
|
|
359
|
-
* ];
|
|
359
|
+
* ] as const;
|
|
360
360
|
*
|
|
361
361
|
* const nullishValues = values.filter(isNullish);
|
|
362
362
|
*
|
|
@@ -388,7 +388,7 @@ const isNullish = (u) => u == null;
|
|
|
388
388
|
* 'Ada',
|
|
389
389
|
* null,
|
|
390
390
|
* undefined,
|
|
391
|
-
* ];
|
|
391
|
+
* ] as const;
|
|
392
392
|
*
|
|
393
393
|
* const definedValues = values.filter(isNonNullish);
|
|
394
394
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-is-in.d.mts","sourceRoot":"","sources":["../../src/guard/key-is-in.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,OAAO,GAClB,KAAK,CAAC,CAAC,SAAS,WAAW,EAC3B,KAAK,CAAC,CAAC,SAAS,aAAa,EAE7B,KAAK,CAAC,EACN,KAAK,CAAC,KACL,GAAG,IAAI,CAAC,GAAG,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"key-is-in.d.mts","sourceRoot":"","sources":["../../src/guard/key-is-in.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,OAAO,GAClB,KAAK,CAAC,CAAC,SAAS,WAAW,EAC3B,KAAK,CAAC,CAAC,SAAS,aAAa,EAE7B,KAAK,CAAC,EACN,KAAK,CAAC,KACL,GAAG,IAAI,CAAC,GAAG,MAAM,OAAO,GAEF,CAAC"}
|
package/dist/guard/key-is-in.mjs
CHANGED
|
@@ -38,7 +38,9 @@
|
|
|
38
38
|
* `true`, TypeScript narrows the key type to be a valid key of the object.
|
|
39
39
|
* @see {@link hasKey} - Similar function that narrows the object type instead of the key type
|
|
40
40
|
*/
|
|
41
|
-
const keyIsIn = (key, obj) =>
|
|
41
|
+
const keyIsIn = (key, obj) =>
|
|
42
|
+
// eslint-disable-next-line ts-data-forge/prefer-is-record-and-has-key
|
|
43
|
+
Object.hasOwn(obj, key);
|
|
42
44
|
|
|
43
45
|
export { keyIsIn };
|
|
44
46
|
//# sourceMappingURL=key-is-in.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-is-in.mjs","sources":["../../src/guard/key-is-in.mts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCG;
|
|
1
|
+
{"version":3,"file":"key-is-in.mjs","sources":["../../src/guard/key-is-in.mts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCG;MACU,OAAO,GAAG,CAIrB,GAAM,EACN,GAAM;AAEN;AACA,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -48,6 +48,7 @@ export { Obj } from './object/object.mjs';
|
|
|
48
48
|
export { castDeepMutable, castMutable } from './others/cast-mutable.mjs';
|
|
49
49
|
export { castDeepReadonly, castReadonly } from './others/cast-readonly.mjs';
|
|
50
50
|
export { debounce } from './others/debounce-function.mjs';
|
|
51
|
+
export { fastDeepEqual } from './others/fast-deep-equal.mjs';
|
|
51
52
|
export { ifThen } from './others/if-then.mjs';
|
|
52
53
|
export { mapNullable } from './others/map-nullable.mjs';
|
|
53
54
|
export { memoizeFunction } from './others/memoize-function.mjs';
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/json/json.d.mts
CHANGED
|
@@ -70,7 +70,7 @@ export declare namespace Json {
|
|
|
70
70
|
* @example
|
|
71
71
|
*
|
|
72
72
|
* ```ts
|
|
73
|
-
* const data = { name: 'Bob', age: 25, active: true };
|
|
73
|
+
* const data = { name: 'Bob', age: 25, active: true } as const;
|
|
74
74
|
*
|
|
75
75
|
* // Basic stringify
|
|
76
76
|
* const basic = Json.stringify(data);
|
|
@@ -141,7 +141,7 @@ export declare namespace Json {
|
|
|
141
141
|
* email: 'charlie@example.com',
|
|
142
142
|
* password: 'secret123',
|
|
143
143
|
* role: 'admin',
|
|
144
|
-
* };
|
|
144
|
+
* } as const;
|
|
145
145
|
*
|
|
146
146
|
* // Select only safe properties to serialize
|
|
147
147
|
* const safeJson = Json.stringifySelected(user, ['id', 'name', 'role']);
|
|
@@ -211,7 +211,7 @@ export declare namespace Json {
|
|
|
211
211
|
* alpha: 'a',
|
|
212
212
|
* beta: 'b',
|
|
213
213
|
* },
|
|
214
|
-
* };
|
|
214
|
+
* } as const;
|
|
215
215
|
*
|
|
216
216
|
* // Keys will be sorted alphabetically at all levels
|
|
217
217
|
* const sorted = Json.stringifySortedKey(unorderedData);
|
package/dist/json/json.mjs
CHANGED
|
@@ -124,7 +124,7 @@ var Json;
|
|
|
124
124
|
* @example
|
|
125
125
|
*
|
|
126
126
|
* ```ts
|
|
127
|
-
* const data = { name: 'Bob', age: 25, active: true };
|
|
127
|
+
* const data = { name: 'Bob', age: 25, active: true } as const;
|
|
128
128
|
*
|
|
129
129
|
* // Basic stringify
|
|
130
130
|
* const basic = Json.stringify(data);
|
|
@@ -203,7 +203,7 @@ var Json;
|
|
|
203
203
|
* email: 'charlie@example.com',
|
|
204
204
|
* password: 'secret123',
|
|
205
205
|
* role: 'admin',
|
|
206
|
-
* };
|
|
206
|
+
* } as const;
|
|
207
207
|
*
|
|
208
208
|
* // Select only safe properties to serialize
|
|
209
209
|
* const safeJson = Json.stringifySelected(user, ['id', 'name', 'role']);
|
|
@@ -281,7 +281,7 @@ var Json;
|
|
|
281
281
|
* alpha: 'a',
|
|
282
282
|
* beta: 'b',
|
|
283
283
|
* },
|
|
284
|
-
* };
|
|
284
|
+
* } as const;
|
|
285
285
|
*
|
|
286
286
|
* // Keys will be sorted alphabetically at all levels
|
|
287
287
|
* const sorted = Json.stringifySortedKey(unorderedData);
|
|
@@ -363,6 +363,7 @@ mut_keys) => {
|
|
|
363
363
|
if (isRecord(o)) {
|
|
364
364
|
keysDeepImpl(o, mut_keys);
|
|
365
365
|
}
|
|
366
|
+
// eslint-disable-next-line ts-data-forge/prefer-arr-is-array
|
|
366
367
|
if (Array.isArray(o)) {
|
|
367
368
|
for (const li of o) {
|
|
368
369
|
if (isRecord(li)) {
|