@duplojs/utils 1.0.7 → 1.1.8
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/array/coalescing.cjs +9 -0
- package/dist/array/coalescing.d.ts +3 -0
- package/dist/array/coalescing.mjs +7 -0
- package/dist/array/index.cjs +2 -0
- package/dist/array/index.d.ts +1 -0
- package/dist/array/index.mjs +1 -0
- package/dist/array/map.cjs +1 -1
- package/dist/array/map.d.ts +2 -2
- package/dist/array/map.mjs +1 -1
- package/dist/array/reduce.cjs +1 -1
- package/dist/array/reduce.mjs +1 -1
- package/dist/array/types/ArrayCoalescing.d.ts +1 -0
- package/dist/array/types/index.d.ts +1 -0
- package/dist/common/escapeRegExp.cjs +2 -2
- package/dist/common/escapeRegExp.d.ts +1 -1
- package/dist/common/escapeRegExp.mjs +2 -2
- package/dist/common/index.d.ts +2 -0
- package/dist/common/instanceOf.cjs +20 -0
- package/dist/common/instanceOf.d.ts +3 -0
- package/dist/common/instanceOf.mjs +18 -0
- package/dist/common/kind.cjs +45 -1
- package/dist/common/kind.d.ts +24 -4
- package/dist/common/kind.mjs +44 -2
- package/dist/common/memo.cjs +16 -0
- package/dist/common/memo.d.ts +5 -0
- package/dist/common/memo.mjs +14 -0
- package/dist/common/simpleClone.cjs +2 -2
- package/dist/common/simpleClone.mjs +2 -2
- package/dist/common/types/anyConstructor.d.ts +1 -0
- package/dist/common/types/anyPredicate.d.ts +1 -0
- package/dist/common/types/index.d.ts +2 -0
- package/dist/common/types/objectEntry.d.ts +1 -1
- package/dist/common/types/predicate.d.ts +1 -0
- package/dist/common/types/unionContain.d.ts +1 -1
- package/dist/dataParser/base.cjs +116 -0
- package/dist/dataParser/base.d.ts +44 -0
- package/dist/dataParser/base.mjs +109 -0
- package/dist/dataParser/baseExtended.cjs +55 -0
- package/dist/dataParser/baseExtended.d.ts +45 -0
- package/dist/dataParser/baseExtended.mjs +52 -0
- package/dist/dataParser/error.cjs +54 -0
- package/dist/dataParser/error.d.ts +31 -0
- package/dist/dataParser/error.mjs +41 -0
- package/dist/dataParser/extended/array.cjs +20 -0
- package/dist/dataParser/extended/array.d.ts +21 -0
- package/dist/dataParser/extended/array.mjs +18 -0
- package/dist/dataParser/extended/bigint.cjs +20 -0
- package/dist/dataParser/extended/bigint.d.ts +19 -0
- package/dist/dataParser/extended/bigint.mjs +18 -0
- package/dist/dataParser/extended/boolean.cjs +11 -0
- package/dist/dataParser/extended/boolean.d.ts +9 -0
- package/dist/dataParser/extended/boolean.mjs +9 -0
- package/dist/dataParser/extended/coerce/bigint.cjs +13 -0
- package/dist/dataParser/extended/coerce/bigint.d.ts +7 -0
- package/dist/dataParser/extended/coerce/bigint.mjs +11 -0
- package/dist/dataParser/extended/coerce/boolean.cjs +13 -0
- package/dist/dataParser/extended/coerce/boolean.d.ts +7 -0
- package/dist/dataParser/extended/coerce/boolean.mjs +11 -0
- package/dist/dataParser/extended/coerce/empty.cjs +13 -0
- package/dist/dataParser/extended/coerce/empty.d.ts +7 -0
- package/dist/dataParser/extended/coerce/empty.mjs +11 -0
- package/dist/dataParser/extended/coerce/index.cjs +17 -0
- package/dist/dataParser/extended/coerce/index.d.ts +6 -0
- package/dist/dataParser/extended/coerce/index.mjs +6 -0
- package/dist/dataParser/extended/coerce/nil.cjs +13 -0
- package/dist/dataParser/extended/coerce/nil.d.ts +7 -0
- package/dist/dataParser/extended/coerce/nil.mjs +11 -0
- package/dist/dataParser/extended/coerce/number.cjs +13 -0
- package/dist/dataParser/extended/coerce/number.d.ts +7 -0
- package/dist/dataParser/extended/coerce/number.mjs +11 -0
- package/dist/dataParser/extended/coerce/string.cjs +13 -0
- package/dist/dataParser/extended/coerce/string.d.ts +7 -0
- package/dist/dataParser/extended/coerce/string.mjs +11 -0
- package/dist/dataParser/extended/empty.cjs +11 -0
- package/dist/dataParser/extended/empty.d.ts +9 -0
- package/dist/dataParser/extended/empty.mjs +9 -0
- package/dist/dataParser/extended/index.cjs +48 -0
- package/dist/dataParser/extended/index.d.ts +22 -0
- package/dist/dataParser/extended/index.mjs +21 -0
- package/dist/dataParser/extended/lazy.cjs +11 -0
- package/dist/dataParser/extended/lazy.d.ts +11 -0
- package/dist/dataParser/extended/lazy.mjs +9 -0
- package/dist/dataParser/extended/literal.cjs +11 -0
- package/dist/dataParser/extended/literal.d.ts +11 -0
- package/dist/dataParser/extended/literal.mjs +9 -0
- package/dist/dataParser/extended/nil.cjs +11 -0
- package/dist/dataParser/extended/nil.d.ts +9 -0
- package/dist/dataParser/extended/nil.mjs +9 -0
- package/dist/dataParser/extended/nullable.cjs +11 -0
- package/dist/dataParser/extended/nullable.d.ts +11 -0
- package/dist/dataParser/extended/nullable.mjs +9 -0
- package/dist/dataParser/extended/number.cjs +27 -0
- package/dist/dataParser/extended/number.d.ts +24 -0
- package/dist/dataParser/extended/number.mjs +24 -0
- package/dist/dataParser/extended/object.cjs +11 -0
- package/dist/dataParser/extended/object.d.ts +11 -0
- package/dist/dataParser/extended/object.mjs +9 -0
- package/dist/dataParser/extended/optional.cjs +11 -0
- package/dist/dataParser/extended/optional.d.ts +11 -0
- package/dist/dataParser/extended/optional.mjs +9 -0
- package/dist/dataParser/extended/pipe.cjs +11 -0
- package/dist/dataParser/extended/pipe.d.ts +12 -0
- package/dist/dataParser/extended/pipe.mjs +9 -0
- package/dist/dataParser/extended/record.cjs +11 -0
- package/dist/dataParser/extended/record.d.ts +12 -0
- package/dist/dataParser/extended/record.mjs +9 -0
- package/dist/dataParser/extended/string.cjs +38 -0
- package/dist/dataParser/extended/string.d.ts +32 -0
- package/dist/dataParser/extended/string.mjs +34 -0
- package/dist/dataParser/extended/templateLiteral.cjs +10 -0
- package/dist/dataParser/extended/templateLiteral.d.ts +11 -0
- package/dist/dataParser/extended/templateLiteral.mjs +8 -0
- package/dist/dataParser/extended/transform.cjs +11 -0
- package/dist/dataParser/extended/transform.d.ts +14 -0
- package/dist/dataParser/extended/transform.mjs +9 -0
- package/dist/dataParser/extended/tuple.cjs +11 -0
- package/dist/dataParser/extended/tuple.d.ts +11 -0
- package/dist/dataParser/extended/tuple.mjs +9 -0
- package/dist/dataParser/extended/union.cjs +11 -0
- package/dist/dataParser/extended/union.d.ts +11 -0
- package/dist/dataParser/extended/union.mjs +9 -0
- package/dist/dataParser/extended/unknown.cjs +11 -0
- package/dist/dataParser/extended/unknown.d.ts +9 -0
- package/dist/dataParser/extended/unknown.mjs +9 -0
- package/dist/dataParser/index.cjs +128 -0
- package/dist/dataParser/index.d.ts +6 -0
- package/dist/dataParser/index.mjs +38 -0
- package/dist/dataParser/kind.cjs +7 -0
- package/dist/dataParser/kind.d.ts +1 -0
- package/dist/dataParser/kind.mjs +5 -0
- package/dist/dataParser/parsers/array/checkers/index.d.ts +2 -0
- package/dist/dataParser/parsers/array/checkers/max.cjs +23 -0
- package/dist/dataParser/parsers/array/checkers/max.d.ts +11 -0
- package/dist/dataParser/parsers/array/checkers/max.mjs +20 -0
- package/dist/dataParser/parsers/array/checkers/min.cjs +23 -0
- package/dist/dataParser/parsers/array/checkers/min.d.ts +11 -0
- package/dist/dataParser/parsers/array/checkers/min.mjs +20 -0
- package/dist/dataParser/parsers/array/index.cjs +64 -0
- package/dist/dataParser/parsers/array/index.d.ts +20 -0
- package/dist/dataParser/parsers/array/index.mjs +61 -0
- package/dist/dataParser/parsers/bigint/checkers/index.d.ts +2 -0
- package/dist/dataParser/parsers/bigint/checkers/max.cjs +23 -0
- package/dist/dataParser/parsers/bigint/checkers/max.d.ts +11 -0
- package/dist/dataParser/parsers/bigint/checkers/max.mjs +20 -0
- package/dist/dataParser/parsers/bigint/checkers/min.cjs +23 -0
- package/dist/dataParser/parsers/bigint/checkers/min.d.ts +11 -0
- package/dist/dataParser/parsers/bigint/checkers/min.mjs +20 -0
- package/dist/dataParser/parsers/bigint/index.cjs +31 -0
- package/dist/dataParser/parsers/bigint/index.d.ts +18 -0
- package/dist/dataParser/parsers/bigint/index.mjs +28 -0
- package/dist/dataParser/parsers/boolean.cjs +40 -0
- package/dist/dataParser/parsers/boolean.d.ts +12 -0
- package/dist/dataParser/parsers/boolean.mjs +37 -0
- package/dist/dataParser/parsers/coerce/bigint.cjs +13 -0
- package/dist/dataParser/parsers/coerce/bigint.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/bigint.mjs +11 -0
- package/dist/dataParser/parsers/coerce/boolean.cjs +13 -0
- package/dist/dataParser/parsers/coerce/boolean.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/boolean.mjs +11 -0
- package/dist/dataParser/parsers/coerce/empty.cjs +13 -0
- package/dist/dataParser/parsers/coerce/empty.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/empty.mjs +11 -0
- package/dist/dataParser/parsers/coerce/index.cjs +17 -0
- package/dist/dataParser/parsers/coerce/index.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/index.mjs +6 -0
- package/dist/dataParser/parsers/coerce/nil.cjs +13 -0
- package/dist/dataParser/parsers/coerce/nil.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/nil.mjs +11 -0
- package/dist/dataParser/parsers/coerce/number.cjs +13 -0
- package/dist/dataParser/parsers/coerce/number.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/number.mjs +11 -0
- package/dist/dataParser/parsers/coerce/string.cjs +13 -0
- package/dist/dataParser/parsers/coerce/string.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/string.mjs +11 -0
- package/dist/dataParser/parsers/empty.cjs +27 -0
- package/dist/dataParser/parsers/empty.d.ts +12 -0
- package/dist/dataParser/parsers/empty.mjs +24 -0
- package/dist/dataParser/parsers/index.d.ts +20 -0
- package/dist/dataParser/parsers/lazy.cjs +21 -0
- package/dist/dataParser/parsers/lazy.d.ts +14 -0
- package/dist/dataParser/parsers/lazy.mjs +18 -0
- package/dist/dataParser/parsers/literal.cjs +25 -0
- package/dist/dataParser/parsers/literal.d.ts +15 -0
- package/dist/dataParser/parsers/literal.mjs +22 -0
- package/dist/dataParser/parsers/nil.cjs +27 -0
- package/dist/dataParser/parsers/nil.d.ts +12 -0
- package/dist/dataParser/parsers/nil.mjs +24 -0
- package/dist/dataParser/parsers/nullable.cjs +31 -0
- package/dist/dataParser/parsers/nullable.d.ts +14 -0
- package/dist/dataParser/parsers/nullable.mjs +28 -0
- package/dist/dataParser/parsers/number/checkers/index.d.ts +3 -0
- package/dist/dataParser/parsers/number/checkers/int.cjs +27 -0
- package/dist/dataParser/parsers/number/checkers/int.d.ts +15 -0
- package/dist/dataParser/parsers/number/checkers/int.mjs +23 -0
- package/dist/dataParser/parsers/number/checkers/max.cjs +18 -0
- package/dist/dataParser/parsers/number/checkers/max.d.ts +11 -0
- package/dist/dataParser/parsers/number/checkers/max.mjs +15 -0
- package/dist/dataParser/parsers/number/checkers/min.cjs +18 -0
- package/dist/dataParser/parsers/number/checkers/min.d.ts +11 -0
- package/dist/dataParser/parsers/number/checkers/min.mjs +15 -0
- package/dist/dataParser/parsers/number/index.cjs +31 -0
- package/dist/dataParser/parsers/number/index.d.ts +18 -0
- package/dist/dataParser/parsers/number/index.mjs +28 -0
- package/dist/dataParser/parsers/object.cjs +74 -0
- package/dist/dataParser/parsers/object.d.ts +26 -0
- package/dist/dataParser/parsers/object.mjs +71 -0
- package/dist/dataParser/parsers/optional.cjs +31 -0
- package/dist/dataParser/parsers/optional.d.ts +14 -0
- package/dist/dataParser/parsers/optional.mjs +28 -0
- package/dist/dataParser/parsers/pipe.cjs +34 -0
- package/dist/dataParser/parsers/pipe.d.ts +16 -0
- package/dist/dataParser/parsers/pipe.mjs +31 -0
- package/dist/dataParser/parsers/record.cjs +83 -0
- package/dist/dataParser/parsers/record.d.ts +30 -0
- package/dist/dataParser/parsers/record.mjs +80 -0
- package/dist/dataParser/parsers/string/checkers/email.cjs +31 -0
- package/dist/dataParser/parsers/string/checkers/email.d.ts +17 -0
- package/dist/dataParser/parsers/string/checkers/email.mjs +27 -0
- package/dist/dataParser/parsers/string/checkers/index.d.ts +5 -0
- package/dist/dataParser/parsers/string/checkers/max.cjs +18 -0
- package/dist/dataParser/parsers/string/checkers/max.d.ts +11 -0
- package/dist/dataParser/parsers/string/checkers/max.mjs +15 -0
- package/dist/dataParser/parsers/string/checkers/min.cjs +18 -0
- package/dist/dataParser/parsers/string/checkers/min.d.ts +11 -0
- package/dist/dataParser/parsers/string/checkers/min.mjs +15 -0
- package/dist/dataParser/parsers/string/checkers/regex.cjs +20 -0
- package/dist/dataParser/parsers/string/checkers/regex.d.ts +11 -0
- package/dist/dataParser/parsers/string/checkers/regex.mjs +17 -0
- package/dist/dataParser/parsers/string/checkers/url.cjs +48 -0
- package/dist/dataParser/parsers/string/checkers/url.d.ts +18 -0
- package/dist/dataParser/parsers/string/checkers/url.mjs +44 -0
- package/dist/dataParser/parsers/string/index.cjs +31 -0
- package/dist/dataParser/parsers/string/index.d.ts +18 -0
- package/dist/dataParser/parsers/string/index.mjs +28 -0
- package/dist/dataParser/parsers/templateLiteral.cjs +45 -0
- package/dist/dataParser/parsers/templateLiteral.d.ts +49 -0
- package/dist/dataParser/parsers/templateLiteral.mjs +42 -0
- package/dist/dataParser/parsers/transform.cjs +43 -0
- package/dist/dataParser/parsers/transform.d.ts +17 -0
- package/dist/dataParser/parsers/transform.mjs +40 -0
- package/dist/dataParser/parsers/tuple.cjs +83 -0
- package/dist/dataParser/parsers/tuple.d.ts +33 -0
- package/dist/dataParser/parsers/tuple.mjs +80 -0
- package/dist/dataParser/parsers/union.cjs +38 -0
- package/dist/dataParser/parsers/union.d.ts +15 -0
- package/dist/dataParser/parsers/union.mjs +35 -0
- package/dist/dataParser/parsers/unknown.cjs +17 -0
- package/dist/dataParser/parsers/unknown.d.ts +11 -0
- package/dist/dataParser/parsers/unknown.mjs +14 -0
- package/dist/dataParser/types/addCheckersToDefinition.d.ts +5 -0
- package/dist/dataParser/types/checkers.d.ts +3 -0
- package/dist/dataParser/types/dataParsers.d.ts +5 -0
- package/dist/dataParser/types/index.d.ts +4 -0
- package/dist/dataParser/types/mergeDefinition.d.ts +5 -0
- package/dist/either/bool/base.cjs +2 -2
- package/dist/either/bool/base.d.ts +1 -1
- package/dist/either/bool/base.mjs +2 -2
- package/dist/either/bool/falsy.cjs +5 -5
- package/dist/either/bool/falsy.d.ts +4 -4
- package/dist/either/bool/falsy.mjs +5 -5
- package/dist/either/bool/truthy.cjs +4 -4
- package/dist/either/bool/truthy.d.ts +5 -5
- package/dist/either/bool/truthy.mjs +4 -4
- package/dist/either/future/base.cjs +2 -2
- package/dist/either/future/base.d.ts +1 -1
- package/dist/either/future/base.mjs +2 -2
- package/dist/either/future/error.cjs +3 -3
- package/dist/either/future/error.d.ts +1 -1
- package/dist/either/future/error.mjs +3 -3
- package/dist/either/future/success.cjs +3 -3
- package/dist/either/future/success.d.ts +2 -2
- package/dist/either/future/success.mjs +3 -3
- package/dist/either/hasInformation.cjs +3 -3
- package/dist/either/hasInformation.d.ts +1 -1
- package/dist/either/hasInformation.mjs +1 -1
- package/dist/either/index.cjs +3 -2
- package/dist/either/index.d.ts +1 -1
- package/dist/either/index.mjs +1 -1
- package/dist/either/kind.cjs +9 -0
- package/dist/either/kind.d.ts +2 -0
- package/dist/either/kind.mjs +6 -0
- package/dist/either/left/create.cjs +3 -4
- package/dist/either/left/create.d.ts +2 -2
- package/dist/either/left/create.mjs +3 -4
- package/dist/either/left/error.cjs +3 -3
- package/dist/either/left/error.d.ts +1 -1
- package/dist/either/left/error.mjs +3 -3
- package/dist/either/left/fail.cjs +3 -3
- package/dist/either/left/fail.d.ts +1 -1
- package/dist/either/left/fail.mjs +3 -3
- package/dist/either/left/is.cjs +2 -2
- package/dist/either/left/is.mjs +1 -1
- package/dist/either/nullable/base.cjs +2 -2
- package/dist/either/nullable/base.d.ts +1 -1
- package/dist/either/nullable/base.mjs +2 -2
- package/dist/either/nullable/empty.cjs +3 -3
- package/dist/either/nullable/empty.d.ts +1 -1
- package/dist/either/nullable/empty.mjs +3 -3
- package/dist/either/nullable/filled.cjs +3 -3
- package/dist/either/nullable/filled.d.ts +1 -1
- package/dist/either/nullable/filled.mjs +3 -3
- package/dist/either/nullish/base.cjs +2 -2
- package/dist/either/nullish/base.d.ts +1 -1
- package/dist/either/nullish/base.mjs +2 -2
- package/dist/either/nullish/empty.cjs +3 -3
- package/dist/either/nullish/empty.d.ts +2 -2
- package/dist/either/nullish/empty.mjs +3 -3
- package/dist/either/nullish/filled.cjs +4 -4
- package/dist/either/nullish/filled.d.ts +1 -1
- package/dist/either/nullish/filled.mjs +4 -4
- package/dist/either/optional/base.cjs +2 -2
- package/dist/either/optional/base.d.ts +1 -1
- package/dist/either/optional/base.mjs +2 -2
- package/dist/either/optional/empty.cjs +5 -5
- package/dist/either/optional/empty.d.ts +3 -3
- package/dist/either/optional/empty.mjs +5 -5
- package/dist/either/optional/filled.cjs +5 -5
- package/dist/either/optional/filled.d.ts +3 -3
- package/dist/either/optional/filled.mjs +5 -5
- package/dist/either/right/asyncPipe.d.ts +2 -2
- package/dist/either/right/create.cjs +3 -4
- package/dist/either/right/create.d.ts +2 -2
- package/dist/either/right/create.mjs +3 -4
- package/dist/either/right/is.cjs +2 -2
- package/dist/either/right/is.mjs +1 -1
- package/dist/either/right/ok.cjs +3 -3
- package/dist/either/right/ok.d.ts +1 -1
- package/dist/either/right/ok.mjs +3 -3
- package/dist/either/right/success.cjs +3 -3
- package/dist/either/right/success.d.ts +2 -2
- package/dist/either/right/success.mjs +3 -3
- package/dist/either/whenHasInformation.cjs +2 -2
- package/dist/either/whenHasInformation.d.ts +1 -1
- package/dist/either/whenHasInformation.mjs +1 -1
- package/dist/generator/reduce.cjs +1 -1
- package/dist/generator/reduce.mjs +1 -1
- package/dist/index.cjs +15 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +12 -1
- package/dist/number/greater.cjs +12 -0
- package/dist/number/greater.d.ts +2 -0
- package/dist/number/greater.mjs +10 -0
- package/dist/number/greaterThan.cjs +12 -0
- package/dist/number/greaterThan.d.ts +2 -0
- package/dist/number/greaterThan.mjs +10 -0
- package/dist/number/index.cjs +8 -0
- package/dist/number/index.d.ts +4 -0
- package/dist/number/index.mjs +4 -0
- package/dist/number/less.cjs +12 -0
- package/dist/number/less.d.ts +2 -0
- package/dist/number/less.mjs +10 -0
- package/dist/number/lessThan.cjs +12 -0
- package/dist/number/lessThan.d.ts +2 -0
- package/dist/number/lessThan.mjs +10 -0
- package/dist/object/fromEntries.d.ts +1 -1
- package/dist/object/types/getPropsWithValueExtends.d.ts +1 -1
- package/dist/pattern/result.cjs +1 -1
- package/dist/pattern/result.mjs +1 -1
- package/dist/string/types/forbiddenCharacters.d.ts +5 -0
- package/dist/string/types/index.d.ts +1 -0
- package/package.json +57 -1
- package/dist/either/base.cjs +0 -7
- package/dist/either/base.d.ts +0 -1
- package/dist/either/base.mjs +0 -5
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { createKind } from '../../common/kind.mjs';
|
|
2
1
|
import { wrapValue } from '../../common/wrapValue.mjs';
|
|
3
|
-
import { eitherInformationKind } from '../
|
|
2
|
+
import { createEitherKind, eitherInformationKind } from '../kind.mjs';
|
|
4
3
|
|
|
5
|
-
const eitherRightKind =
|
|
4
|
+
const eitherRightKind = createEitherKind("right");
|
|
6
5
|
function right(information, value = undefined) {
|
|
7
|
-
return eitherRightKind.
|
|
6
|
+
return eitherRightKind.setTo(eitherInformationKind.setTo(wrapValue(value), information));
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
export { eitherRightKind, right };
|
package/dist/either/right/is.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var kind = require('../kind.cjs');
|
|
4
4
|
var create = require('./create.cjs');
|
|
5
5
|
var wrapValue = require('../../common/wrapValue.cjs');
|
|
6
6
|
|
|
7
7
|
function isRight(input) {
|
|
8
8
|
return create.eitherRightKind.has(input)
|
|
9
|
-
&&
|
|
9
|
+
&& kind.eitherInformationKind.has(input)
|
|
10
10
|
&& wrapValue.isWrappedValue(input);
|
|
11
11
|
}
|
|
12
12
|
|
package/dist/either/right/is.mjs
CHANGED
package/dist/either/right/ok.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('
|
|
3
|
+
var kind = require('../kind.cjs');
|
|
4
4
|
var create = require('./create.cjs');
|
|
5
5
|
|
|
6
|
-
const eitherOkKind = kind.
|
|
6
|
+
const eitherOkKind = kind.createEitherKind("ok");
|
|
7
7
|
function ok() {
|
|
8
|
-
return eitherOkKind.
|
|
8
|
+
return eitherOkKind.setTo(create.right("ok", undefined));
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
exports.eitherOkKind = eitherOkKind;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Kind } from "../../common/kind";
|
|
2
2
|
import { type EitherRight } from "./create";
|
|
3
|
-
export declare const eitherOkKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"
|
|
3
|
+
export declare const eitherOkKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@Either/ok", unknown>>;
|
|
4
4
|
type _EitherOk = (EitherRight<"ok", never> & Kind<typeof eitherOkKind.definition>);
|
|
5
5
|
export interface EitherOk extends _EitherOk {
|
|
6
6
|
}
|
package/dist/either/right/ok.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createEitherKind } from '../kind.mjs';
|
|
2
2
|
import { right } from './create.mjs';
|
|
3
3
|
|
|
4
|
-
const eitherOkKind =
|
|
4
|
+
const eitherOkKind = createEitherKind("ok");
|
|
5
5
|
function ok() {
|
|
6
|
-
return eitherOkKind.
|
|
6
|
+
return eitherOkKind.setTo(right("ok", undefined));
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export { eitherOkKind, ok };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var kind = require('../kind.cjs');
|
|
3
4
|
var create = require('./create.cjs');
|
|
4
|
-
var kind = require('../../common/kind.cjs');
|
|
5
5
|
|
|
6
|
-
const eitherSuccessKind = kind.
|
|
6
|
+
const eitherSuccessKind = kind.createEitherKind("success");
|
|
7
7
|
function success(value) {
|
|
8
|
-
return eitherSuccessKind.
|
|
8
|
+
return eitherSuccessKind.setTo(create.right("success", value));
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
exports.eitherSuccessKind = eitherSuccessKind;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type EitherRight } from "./create";
|
|
2
1
|
import { type Kind } from "../../common/kind";
|
|
3
|
-
|
|
2
|
+
import { type EitherRight } from "./create";
|
|
3
|
+
export declare const eitherSuccessKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@Either/success", unknown>>;
|
|
4
4
|
type _EitherSuccess<GenericValue extends unknown = unknown> = (EitherRight<"success", GenericValue> & Kind<typeof eitherSuccessKind.definition>);
|
|
5
5
|
export interface EitherSuccess<GenericValue extends unknown = unknown> extends _EitherSuccess<GenericValue> {
|
|
6
6
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { createEitherKind } from '../kind.mjs';
|
|
1
2
|
import { right } from './create.mjs';
|
|
2
|
-
import { createKind } from '../../common/kind.mjs';
|
|
3
3
|
|
|
4
|
-
const eitherSuccessKind =
|
|
4
|
+
const eitherSuccessKind = createEitherKind("success");
|
|
5
5
|
function success(value) {
|
|
6
|
-
return eitherSuccessKind.
|
|
6
|
+
return eitherSuccessKind.setTo(right("success", value));
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export { eitherSuccessKind, success };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var unwrap = require('../common/unwrap.cjs');
|
|
4
|
-
var
|
|
4
|
+
var kind = require('./kind.cjs');
|
|
5
5
|
var is = require('./left/is.cjs');
|
|
6
6
|
var is$1 = require('./right/is.cjs');
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ function whenHasInformation(...args) {
|
|
|
15
15
|
? information
|
|
16
16
|
: [information];
|
|
17
17
|
if ((is.isLeft(input)
|
|
18
|
-
|| is$1.isRight(input)) && formattedInformation.includes(
|
|
18
|
+
|| is$1.isRight(input)) && formattedInformation.includes(kind.eitherInformationKind.getValue(input))) {
|
|
19
19
|
return theFunction(unwrap.unwrap(input));
|
|
20
20
|
}
|
|
21
21
|
return input;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Kind, type WrappedValue, type AnyValue, type Unwrap, type BreakGenericLink } from "../common";
|
|
2
2
|
import { type EitherRight } from "./right";
|
|
3
3
|
import { type EitherLeft } from "./left";
|
|
4
|
-
import { eitherInformationKind } from "./
|
|
4
|
+
import { eitherInformationKind } from "./kind";
|
|
5
5
|
type Either = EitherRight | EitherLeft;
|
|
6
6
|
export declare function whenHasInformation<const GenericInput extends unknown, GenericInformation extends (GenericInput extends Either ? ReturnType<typeof eitherInformationKind.getValue<GenericInput>> : never), const GenericOutput extends AnyValue>(information: GenericInformation | GenericInformation[], theFunction: (value: Unwrap<Extract<GenericInput, Kind<typeof eitherInformationKind.definition, GenericInformation> & WrappedValue>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<BreakGenericLink<GenericInput>, Kind<typeof eitherInformationKind.definition, GenericInformation>>;
|
|
7
7
|
export declare function whenHasInformation<const GenericInput extends unknown, GenericInformation extends (GenericInput extends Either ? ReturnType<typeof eitherInformationKind.getValue<GenericInput>> : never), const GenericOutput extends AnyValue>(input: GenericInput, information: GenericInformation | GenericInformation[], theFunction: (value: Unwrap<Extract<GenericInput, Kind<typeof eitherInformationKind.definition, GenericInformation> & WrappedValue>>) => GenericOutput): GenericOutput | Exclude<GenericInput, Kind<typeof eitherInformationKind.definition, GenericInformation>>;
|
|
@@ -7,7 +7,7 @@ var override = require('../object/override.cjs');
|
|
|
7
7
|
|
|
8
8
|
const generatorReduceFromKind = kind.createKind("generator-reduce-from");
|
|
9
9
|
function reduceFrom(value) {
|
|
10
|
-
return generatorReduceFromKind.
|
|
10
|
+
return generatorReduceFromKind.setTo(wrapValue.wrapValue(value));
|
|
11
11
|
}
|
|
12
12
|
function reduce(...args) {
|
|
13
13
|
if (args.length === 2) {
|
|
@@ -5,7 +5,7 @@ import { override } from '../object/override.mjs';
|
|
|
5
5
|
|
|
6
6
|
const generatorReduceFromKind = createKind("generator-reduce-from");
|
|
7
7
|
function reduceFrom(value) {
|
|
8
|
-
return generatorReduceFromKind.
|
|
8
|
+
return generatorReduceFromKind.setTo(wrapValue(value));
|
|
9
9
|
}
|
|
10
10
|
function reduce(...args) {
|
|
11
11
|
if (args.length === 2) {
|
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,8 @@ var and = require('./common/and.cjs');
|
|
|
35
35
|
var or = require('./common/or.cjs');
|
|
36
36
|
var whenElse = require('./common/whenElse.cjs');
|
|
37
37
|
var justReturn = require('./common/justReturn.cjs');
|
|
38
|
+
var memo = require('./common/memo.cjs');
|
|
39
|
+
var instanceOf = require('./common/instanceOf.cjs');
|
|
38
40
|
var index = require('./array/index.cjs');
|
|
39
41
|
var index$1 = require('./number/index.cjs');
|
|
40
42
|
var index$2 = require('./either/index.cjs');
|
|
@@ -42,6 +44,9 @@ var index$3 = require('./object/index.cjs');
|
|
|
42
44
|
var index$4 = require('./string/index.cjs');
|
|
43
45
|
var index$5 = require('./generator/index.cjs');
|
|
44
46
|
var index$6 = require('./pattern/index.cjs');
|
|
47
|
+
var index$7 = require('./dataParser/index.cjs');
|
|
48
|
+
var index$8 = require('./dataParser/parsers/coerce/index.cjs');
|
|
49
|
+
var index$9 = require('./dataParser/extended/index.cjs');
|
|
45
50
|
|
|
46
51
|
|
|
47
52
|
|
|
@@ -53,7 +58,9 @@ exports.escapeRegExp = escapeRegExp.escapeRegExp;
|
|
|
53
58
|
exports.createExternalPromise = externalPromise.createExternalPromise;
|
|
54
59
|
exports.createInterpolation = interpolation.createInterpolation;
|
|
55
60
|
exports.createKind = kind.createKind;
|
|
61
|
+
exports.createKindNamespace = kind.createKindNamespace;
|
|
56
62
|
exports.keyKindPrefix = kind.keyKindPrefix;
|
|
63
|
+
exports.kindHeritage = kind.kindHeritage;
|
|
57
64
|
exports.pipe = pipe.pipe;
|
|
58
65
|
exports.promiseObject = promiseObject.promiseObject;
|
|
59
66
|
exports.simpleClone = simpleClone.simpleClone;
|
|
@@ -86,6 +93,8 @@ exports.and = and.and;
|
|
|
86
93
|
exports.or = or.or;
|
|
87
94
|
exports.whenElse = whenElse.whenElse;
|
|
88
95
|
exports.justReturn = justReturn.justReturn;
|
|
96
|
+
exports.memo = memo.memo;
|
|
97
|
+
exports.instanceOf = instanceOf.instanceOf;
|
|
89
98
|
exports.A = index;
|
|
90
99
|
exports.DArray = index;
|
|
91
100
|
exports.DNumber = index$1;
|
|
@@ -100,3 +109,9 @@ exports.DGenerator = index$5;
|
|
|
100
109
|
exports.G = index$5;
|
|
101
110
|
exports.DPattern = index$6;
|
|
102
111
|
exports.P = index$6;
|
|
112
|
+
exports.DDataParser = index$7;
|
|
113
|
+
exports.DP = index$7;
|
|
114
|
+
exports.DDataParserCoerce = index$8;
|
|
115
|
+
exports.DPC = index$8;
|
|
116
|
+
exports.DDataParserExtended = index$9;
|
|
117
|
+
exports.DPE = index$9;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,3 +13,9 @@ export * as G from "./generator";
|
|
|
13
13
|
export * as DGenerator from "./generator";
|
|
14
14
|
export * as P from "./pattern";
|
|
15
15
|
export * as DPattern from "./pattern";
|
|
16
|
+
export * as DP from "./dataParser";
|
|
17
|
+
export * as DDataParser from "./dataParser";
|
|
18
|
+
export * as DPC from "./dataParser/parsers/coerce";
|
|
19
|
+
export * as DDataParserCoerce from "./dataParser/parsers/coerce";
|
|
20
|
+
export * as DPE from "./dataParser/extended";
|
|
21
|
+
export * as DDataParserExtended from "./dataParser/extended";
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ export { createEnum } from './common/enum.mjs';
|
|
|
5
5
|
export { escapeRegExp } from './common/escapeRegExp.mjs';
|
|
6
6
|
export { createExternalPromise } from './common/externalPromise.mjs';
|
|
7
7
|
export { createInterpolation } from './common/interpolation.mjs';
|
|
8
|
-
export { createKind, keyKindPrefix } from './common/kind.mjs';
|
|
8
|
+
export { createKind, createKindNamespace, keyKindPrefix, kindHeritage } from './common/kind.mjs';
|
|
9
9
|
export { pipe } from './common/pipe.mjs';
|
|
10
10
|
export { promiseObject } from './common/promiseObject.mjs';
|
|
11
11
|
export { simpleClone } from './common/simpleClone.mjs';
|
|
@@ -33,6 +33,8 @@ export { and } from './common/and.mjs';
|
|
|
33
33
|
export { or } from './common/or.mjs';
|
|
34
34
|
export { whenElse } from './common/whenElse.mjs';
|
|
35
35
|
export { justReturn } from './common/justReturn.mjs';
|
|
36
|
+
export { memo } from './common/memo.mjs';
|
|
37
|
+
export { instanceOf } from './common/instanceOf.mjs';
|
|
36
38
|
import * as index from './array/index.mjs';
|
|
37
39
|
export { index as A };
|
|
38
40
|
export { index as DArray };
|
|
@@ -54,3 +56,12 @@ export { index$5 as G };
|
|
|
54
56
|
import * as index$6 from './pattern/index.mjs';
|
|
55
57
|
export { index$6 as DPattern };
|
|
56
58
|
export { index$6 as P };
|
|
59
|
+
import * as index$7 from './dataParser/index.mjs';
|
|
60
|
+
export { index$7 as DDataParser };
|
|
61
|
+
export { index$7 as DP };
|
|
62
|
+
import * as index$8 from './dataParser/parsers/coerce/index.mjs';
|
|
63
|
+
export { index$8 as DDataParserCoerce };
|
|
64
|
+
export { index$8 as DPC };
|
|
65
|
+
import * as index$9 from './dataParser/extended/index.mjs';
|
|
66
|
+
export { index$9 as DDataParserExtended };
|
|
67
|
+
export { index$9 as DPE };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function greaterThan(...args) {
|
|
4
|
+
if (args.length === 1) {
|
|
5
|
+
const [threshold] = args;
|
|
6
|
+
return (value) => greaterThan(value, threshold);
|
|
7
|
+
}
|
|
8
|
+
const [value, threshold] = args;
|
|
9
|
+
return value > threshold;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.greaterThan = greaterThan;
|
package/dist/number/index.cjs
CHANGED
|
@@ -22,6 +22,10 @@ var sin = require('./sin.cjs');
|
|
|
22
22
|
var subtract = require('./subtract.cjs');
|
|
23
23
|
var tan = require('./tan.cjs');
|
|
24
24
|
var trunc = require('./trunc.cjs');
|
|
25
|
+
var greater = require('./greater.cjs');
|
|
26
|
+
var less = require('./less.cjs');
|
|
27
|
+
var greaterThan = require('./greaterThan.cjs');
|
|
28
|
+
var lessThan = require('./lessThan.cjs');
|
|
25
29
|
|
|
26
30
|
|
|
27
31
|
|
|
@@ -47,3 +51,7 @@ exports.sin = sin.sin;
|
|
|
47
51
|
exports.subtract = subtract.subtract;
|
|
48
52
|
exports.tan = tan.tan;
|
|
49
53
|
exports.trunc = trunc.trunc;
|
|
54
|
+
exports.greater = greater.greater;
|
|
55
|
+
exports.less = less.less;
|
|
56
|
+
exports.greaterThan = greaterThan.greaterThan;
|
|
57
|
+
exports.lessThan = lessThan.lessThan;
|
package/dist/number/index.d.ts
CHANGED
package/dist/number/index.mjs
CHANGED
|
@@ -20,3 +20,7 @@ export { sin } from './sin.mjs';
|
|
|
20
20
|
export { subtract } from './subtract.mjs';
|
|
21
21
|
export { tan } from './tan.mjs';
|
|
22
22
|
export { trunc } from './trunc.mjs';
|
|
23
|
+
export { greater } from './greater.mjs';
|
|
24
|
+
export { less } from './less.mjs';
|
|
25
|
+
export { greaterThan } from './greaterThan.mjs';
|
|
26
|
+
export { lessThan } from './lessThan.mjs';
|
|
@@ -2,5 +2,5 @@ import { type ObjectEntry, type ObjectKey, type AnyValue, type SimplifyTopLevel
|
|
|
2
2
|
type ComputeEntries<GenericEntry extends ObjectEntry> = SimplifyTopLevel<{
|
|
3
3
|
[Entry in GenericEntry as Entry[0]]?: Entry[1];
|
|
4
4
|
}>;
|
|
5
|
-
export declare function fromEntries<GenericKey extends ObjectKey, GenericValue extends AnyValue, GenericEntry extends [GenericKey, GenericValue]>(entries: GenericEntry[]): ComputeEntries<GenericEntry>;
|
|
5
|
+
export declare function fromEntries<GenericKey extends ObjectKey, GenericValue extends AnyValue, GenericEntry extends readonly [GenericKey, GenericValue]>(entries: readonly GenericEntry[]): ComputeEntries<GenericEntry>;
|
|
6
6
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type GetPropsWithValueExtends<GenericObject extends object, GenericValue extends unknown> = {
|
|
2
|
-
[Prop in keyof GenericObject]: GenericObject[Prop] extends GenericValue ? Prop : never;
|
|
2
|
+
[Prop in keyof GenericObject]: GenericObject[Prop] extends infer InferredValue ? InferredValue extends GenericValue ? Prop : never : never;
|
|
3
3
|
}[keyof GenericObject];
|
package/dist/pattern/result.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var wrapValue = require('../common/wrapValue.cjs');
|
|
|
5
5
|
|
|
6
6
|
const patternResultKind = kind.createKind("pattern-result");
|
|
7
7
|
function result(value) {
|
|
8
|
-
return patternResultKind.
|
|
8
|
+
return patternResultKind.setTo(wrapValue.wrapValue(value));
|
|
9
9
|
}
|
|
10
10
|
const isResult = patternResultKind.has;
|
|
11
11
|
|
package/dist/pattern/result.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { wrapValue } from '../common/wrapValue.mjs';
|
|
|
3
3
|
|
|
4
4
|
const patternResultKind = createKind("pattern-result");
|
|
5
5
|
function result(value) {
|
|
6
|
-
return patternResultKind.
|
|
6
|
+
return patternResultKind.setTo(wrapValue(value));
|
|
7
7
|
}
|
|
8
8
|
const isResult = patternResultKind.has;
|
|
9
9
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type IsEqual } from "../../common";
|
|
2
|
+
import { type Includes } from "../../string";
|
|
3
|
+
export type ForbiddenCharacters<GenericValue extends string, GenericCharacters extends string> = IsEqual<(GenericCharacters extends string ? Includes<GenericValue, GenericCharacters> : never) | false, boolean> extends true ? {
|
|
4
|
+
error: `Characters "${GenericCharacters}" is forbidden.`;
|
|
5
|
+
} : GenericValue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duplojs/utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"author": "mathcovax",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "rollup --config && tsc-alias -p tsconfig.build.json",
|
|
13
13
|
"test:tu": "vitest --coverage",
|
|
14
|
+
"test:tu:bench": "vitest bench",
|
|
14
15
|
"test:tu:watch": "vitest --coverage --watch",
|
|
15
16
|
"test:tu:update": "vitest --coverage --update",
|
|
16
17
|
"test:types": "tsc -p tsconfig.test.json",
|
|
@@ -24,6 +25,61 @@
|
|
|
24
25
|
"import": "./dist/index.mjs",
|
|
25
26
|
"require": "./dist/index.cjs",
|
|
26
27
|
"types": "./dist/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./array": {
|
|
30
|
+
"import": "./dist/array/index.mjs",
|
|
31
|
+
"require": "./dist/array/index.cjs",
|
|
32
|
+
"types": "./dist/array/index.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./common": {
|
|
35
|
+
"import": "./dist/common/index.mjs",
|
|
36
|
+
"require": "./dist/common/index.cjs",
|
|
37
|
+
"types": "./dist/common/index.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./dataParser": {
|
|
40
|
+
"import": "./dist/dataParser/index.mjs",
|
|
41
|
+
"require": "./dist/dataParser/index.cjs",
|
|
42
|
+
"types": "./dist/dataParser/index.d.ts"
|
|
43
|
+
},
|
|
44
|
+
"./dataParserCoerce": {
|
|
45
|
+
"import": "./dist/dataParser/parsers/coerce/index.mjs",
|
|
46
|
+
"require": "./dist/dataParser/parsers/coerce/index.cjs",
|
|
47
|
+
"types": "./dist/dataParser/parsers/coerce/index.d.ts"
|
|
48
|
+
},
|
|
49
|
+
"./dataParserExtended": {
|
|
50
|
+
"import": "./dist/dataParser/extended/index.mjs",
|
|
51
|
+
"require": "./dist/dataParser/extended/index.cjs",
|
|
52
|
+
"types": "./dist/dataParser/extended/index.d.ts"
|
|
53
|
+
},
|
|
54
|
+
"./either": {
|
|
55
|
+
"import": "./dist/either/index.mjs",
|
|
56
|
+
"require": "./dist/either/index.cjs",
|
|
57
|
+
"types": "./dist/either/index.d.ts"
|
|
58
|
+
},
|
|
59
|
+
"./generator": {
|
|
60
|
+
"import": "./dist/generator/index.mjs",
|
|
61
|
+
"require": "./dist/generator/index.cjs",
|
|
62
|
+
"types": "./dist/generator/index.d.ts"
|
|
63
|
+
},
|
|
64
|
+
"./number": {
|
|
65
|
+
"import": "./dist/number/index.mjs",
|
|
66
|
+
"require": "./dist/number/index.cjs",
|
|
67
|
+
"types": "./dist/number/index.d.ts"
|
|
68
|
+
},
|
|
69
|
+
"./object": {
|
|
70
|
+
"import": "./dist/object/index.mjs",
|
|
71
|
+
"require": "./dist/object/index.cjs",
|
|
72
|
+
"types": "./dist/object/index.d.ts"
|
|
73
|
+
},
|
|
74
|
+
"./pattern": {
|
|
75
|
+
"import": "./dist/pattern/index.mjs",
|
|
76
|
+
"require": "./dist/pattern/index.cjs",
|
|
77
|
+
"types": "./dist/pattern/index.d.ts"
|
|
78
|
+
},
|
|
79
|
+
"./string": {
|
|
80
|
+
"import": "./dist/string/index.mjs",
|
|
81
|
+
"require": "./dist/string/index.cjs",
|
|
82
|
+
"types": "./dist/string/index.d.ts"
|
|
27
83
|
}
|
|
28
84
|
},
|
|
29
85
|
"files": [
|
package/dist/either/base.cjs
DELETED
package/dist/either/base.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const eitherInformationKind: import("../common").KindHandler<import("../common").KindDefinition<"either-information", string>>;
|