@duplojs/utils 1.1.16 → 1.2.17
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/index.cjs +28 -28
- package/dist/array/index.mjs +14 -14
- package/dist/array/reduce.cjs +0 -2
- package/dist/array/reduce.mjs +0 -2
- package/dist/array/reduceRight.cjs +0 -2
- package/dist/array/reduceRight.mjs +0 -2
- package/dist/array/types/extractTuple.d.ts +1 -1
- package/dist/common/asyncInnerPipe.d.ts +16 -11
- package/dist/common/asyncPipe.d.ts +16 -11
- package/dist/common/builder.cjs +5 -11
- package/dist/common/builder.d.ts +7 -7
- package/dist/common/builder.mjs +4 -10
- package/dist/common/createKindIdentifier.cjs +1 -3
- package/dist/common/createKindIdentifier.mjs +1 -3
- package/dist/common/equal.d.ts +4 -4
- package/dist/common/errorKindNamespace.cjs +9 -0
- package/dist/common/errorKindNamespace.d.ts +1 -0
- package/dist/common/errorKindNamespace.mjs +7 -0
- package/dist/common/forwardLog.cjs +8 -0
- package/dist/common/forwardLog.d.ts +1 -0
- package/dist/common/forwardLog.mjs +6 -0
- package/dist/common/index.d.ts +3 -0
- package/dist/common/innerPipe.d.ts +16 -11
- package/dist/common/instanceOf.cjs +0 -2
- package/dist/common/instanceOf.mjs +0 -2
- package/dist/common/kind.d.ts +1 -0
- package/dist/common/override.cjs +36 -0
- package/dist/common/override.d.ts +18 -0
- package/dist/common/override.mjs +34 -0
- package/dist/common/pipe.d.ts +16 -11
- package/dist/common/stringToBytes.cjs +4 -9
- package/dist/common/stringToBytes.d.ts +4 -4
- package/dist/common/stringToBytes.mjs +4 -9
- package/dist/common/stringToMillisecond.cjs +4 -9
- package/dist/common/stringToMillisecond.d.ts +4 -4
- package/dist/common/stringToMillisecond.mjs +4 -9
- package/dist/common/types/objectEntry.d.ts +1 -1
- package/dist/dataParser/base.cjs +7 -6
- package/dist/dataParser/base.d.ts +3 -0
- package/dist/dataParser/base.mjs +7 -6
- package/dist/dataParser/baseExtended.cjs +12 -14
- package/dist/dataParser/baseExtended.d.ts +3 -0
- package/dist/dataParser/baseExtended.mjs +12 -14
- package/dist/dataParser/extended/array.cjs +4 -5
- package/dist/dataParser/extended/array.d.ts +3 -0
- package/dist/dataParser/extended/array.mjs +4 -5
- package/dist/dataParser/extended/bigint.cjs +4 -5
- package/dist/dataParser/extended/bigint.d.ts +3 -0
- package/dist/dataParser/extended/bigint.mjs +4 -5
- package/dist/dataParser/extended/boolean.cjs +4 -5
- package/dist/dataParser/extended/boolean.d.ts +3 -0
- package/dist/dataParser/extended/boolean.mjs +4 -5
- package/dist/dataParser/extended/coerce/bigint.cjs +0 -4
- package/dist/dataParser/extended/coerce/bigint.mjs +0 -4
- package/dist/dataParser/extended/coerce/boolean.cjs +0 -4
- package/dist/dataParser/extended/coerce/boolean.mjs +0 -4
- package/dist/dataParser/extended/coerce/date.cjs +12 -0
- package/dist/dataParser/extended/coerce/date.d.ts +7 -0
- package/dist/dataParser/extended/coerce/date.mjs +10 -0
- package/dist/dataParser/extended/coerce/empty.cjs +0 -4
- package/dist/dataParser/extended/coerce/empty.mjs +0 -4
- package/dist/dataParser/extended/coerce/index.cjs +2 -0
- package/dist/dataParser/extended/coerce/index.d.ts +1 -0
- package/dist/dataParser/extended/coerce/index.mjs +1 -0
- package/dist/dataParser/extended/coerce/nil.cjs +0 -4
- package/dist/dataParser/extended/coerce/nil.mjs +0 -4
- package/dist/dataParser/extended/coerce/number.cjs +0 -4
- package/dist/dataParser/extended/coerce/number.mjs +0 -4
- package/dist/dataParser/extended/coerce/string.cjs +0 -4
- package/dist/dataParser/extended/coerce/string.mjs +0 -4
- package/dist/dataParser/extended/date.cjs +13 -0
- package/dist/dataParser/extended/date.d.ts +23 -0
- package/dist/dataParser/extended/date.mjs +11 -0
- package/dist/dataParser/extended/empty.cjs +4 -5
- package/dist/dataParser/extended/empty.d.ts +3 -0
- package/dist/dataParser/extended/empty.mjs +4 -5
- package/dist/dataParser/extended/index.cjs +15 -0
- package/dist/dataParser/extended/index.d.ts +3 -0
- package/dist/dataParser/extended/index.mjs +2 -0
- package/dist/dataParser/extended/lazy.cjs +4 -5
- package/dist/dataParser/extended/lazy.d.ts +3 -0
- package/dist/dataParser/extended/lazy.mjs +4 -5
- package/dist/dataParser/extended/literal.cjs +4 -5
- package/dist/dataParser/extended/literal.d.ts +3 -0
- package/dist/dataParser/extended/literal.mjs +4 -5
- package/dist/dataParser/extended/nil.cjs +4 -5
- package/dist/dataParser/extended/nil.d.ts +3 -0
- package/dist/dataParser/extended/nil.mjs +4 -5
- package/dist/dataParser/extended/nullable.cjs +4 -5
- package/dist/dataParser/extended/nullable.d.ts +3 -0
- package/dist/dataParser/extended/nullable.mjs +4 -5
- package/dist/dataParser/extended/number.cjs +4 -5
- package/dist/dataParser/extended/number.d.ts +3 -0
- package/dist/dataParser/extended/number.mjs +4 -5
- package/dist/dataParser/extended/object.cjs +19 -6
- package/dist/dataParser/extended/object.d.ts +5 -0
- package/dist/dataParser/extended/object.mjs +19 -6
- package/dist/dataParser/extended/optional.cjs +4 -5
- package/dist/dataParser/extended/optional.d.ts +3 -0
- package/dist/dataParser/extended/optional.mjs +4 -5
- package/dist/dataParser/extended/pipe.cjs +4 -5
- package/dist/dataParser/extended/pipe.d.ts +3 -0
- package/dist/dataParser/extended/pipe.mjs +4 -5
- package/dist/dataParser/extended/record.cjs +4 -5
- package/dist/dataParser/extended/record.d.ts +3 -0
- package/dist/dataParser/extended/record.mjs +4 -5
- package/dist/dataParser/extended/recover.cjs +4 -5
- package/dist/dataParser/extended/recover.d.ts +3 -0
- package/dist/dataParser/extended/recover.mjs +4 -5
- package/dist/dataParser/extended/string.cjs +4 -5
- package/dist/dataParser/extended/string.d.ts +3 -0
- package/dist/dataParser/extended/string.mjs +4 -5
- package/dist/dataParser/extended/templateLiteral.cjs +4 -5
- package/dist/dataParser/extended/templateLiteral.d.ts +3 -0
- package/dist/dataParser/extended/templateLiteral.mjs +4 -5
- package/dist/dataParser/extended/transform.cjs +4 -5
- package/dist/dataParser/extended/transform.d.ts +3 -0
- package/dist/dataParser/extended/transform.mjs +4 -5
- package/dist/dataParser/extended/tuple.cjs +6 -7
- package/dist/dataParser/extended/tuple.d.ts +3 -0
- package/dist/dataParser/extended/tuple.mjs +6 -7
- package/dist/dataParser/extended/union.cjs +4 -5
- package/dist/dataParser/extended/union.d.ts +3 -0
- package/dist/dataParser/extended/union.mjs +4 -5
- package/dist/dataParser/extended/unknown.cjs +4 -5
- package/dist/dataParser/extended/unknown.d.ts +3 -0
- package/dist/dataParser/extended/unknown.mjs +4 -5
- package/dist/dataParser/identifier.cjs +0 -2
- package/dist/dataParser/identifier.d.ts +52 -10
- package/dist/dataParser/identifier.mjs +0 -2
- package/dist/dataParser/index.cjs +72 -65
- package/dist/dataParser/index.mjs +21 -18
- package/dist/dataParser/kind.cjs +0 -2
- package/dist/dataParser/kind.mjs +0 -2
- package/dist/dataParser/parsers/array/index.cjs +4 -1
- package/dist/dataParser/parsers/array/index.d.ts +3 -0
- package/dist/dataParser/parsers/array/index.mjs +4 -1
- package/dist/dataParser/parsers/bigint/index.cjs +4 -1
- package/dist/dataParser/parsers/bigint/index.d.ts +3 -0
- package/dist/dataParser/parsers/bigint/index.mjs +4 -1
- package/dist/dataParser/parsers/boolean.cjs +4 -1
- package/dist/dataParser/parsers/boolean.d.ts +3 -0
- package/dist/dataParser/parsers/boolean.mjs +4 -1
- package/dist/dataParser/parsers/coerce/bigint.cjs +0 -4
- package/dist/dataParser/parsers/coerce/bigint.mjs +0 -4
- package/dist/dataParser/parsers/coerce/boolean.cjs +0 -4
- package/dist/dataParser/parsers/coerce/boolean.mjs +0 -4
- package/dist/dataParser/parsers/coerce/date.cjs +12 -0
- package/dist/dataParser/parsers/coerce/date.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/date.mjs +10 -0
- package/dist/dataParser/parsers/coerce/empty.cjs +0 -4
- package/dist/dataParser/parsers/coerce/empty.mjs +0 -4
- package/dist/dataParser/parsers/coerce/index.cjs +2 -0
- package/dist/dataParser/parsers/coerce/index.d.ts +1 -0
- package/dist/dataParser/parsers/coerce/index.mjs +1 -0
- package/dist/dataParser/parsers/coerce/nil.cjs +0 -4
- package/dist/dataParser/parsers/coerce/nil.mjs +0 -4
- package/dist/dataParser/parsers/coerce/number.cjs +0 -4
- package/dist/dataParser/parsers/coerce/number.mjs +0 -4
- package/dist/dataParser/parsers/coerce/string.cjs +0 -4
- package/dist/dataParser/parsers/coerce/string.mjs +0 -4
- package/dist/dataParser/parsers/date.cjs +50 -0
- package/dist/dataParser/parsers/date.d.ts +28 -0
- package/dist/dataParser/parsers/date.mjs +47 -0
- package/dist/dataParser/parsers/empty.cjs +4 -1
- package/dist/dataParser/parsers/empty.d.ts +3 -0
- package/dist/dataParser/parsers/empty.mjs +4 -1
- package/dist/dataParser/parsers/index.d.ts +1 -0
- package/dist/dataParser/parsers/lazy.cjs +5 -4
- package/dist/dataParser/parsers/lazy.d.ts +3 -0
- package/dist/dataParser/parsers/lazy.mjs +5 -4
- package/dist/dataParser/parsers/literal.cjs +5 -4
- package/dist/dataParser/parsers/literal.d.ts +3 -0
- package/dist/dataParser/parsers/literal.mjs +5 -4
- package/dist/dataParser/parsers/nil.cjs +4 -1
- package/dist/dataParser/parsers/nil.d.ts +3 -0
- package/dist/dataParser/parsers/nil.mjs +4 -1
- package/dist/dataParser/parsers/nullable.cjs +4 -1
- package/dist/dataParser/parsers/nullable.d.ts +3 -0
- package/dist/dataParser/parsers/nullable.mjs +4 -1
- package/dist/dataParser/parsers/number/index.cjs +4 -1
- package/dist/dataParser/parsers/number/index.d.ts +3 -0
- package/dist/dataParser/parsers/number/index.mjs +4 -1
- package/dist/dataParser/parsers/{object.cjs → object/index.cjs} +13 -12
- package/dist/dataParser/parsers/{object.d.ts → object/index.d.ts} +16 -12
- package/dist/dataParser/parsers/{object.mjs → object/index.mjs} +13 -12
- package/dist/dataParser/parsers/object/omit.cjs +15 -0
- package/dist/dataParser/parsers/object/omit.d.ts +6 -0
- package/dist/dataParser/parsers/object/omit.mjs +13 -0
- package/dist/dataParser/parsers/object/pick.cjs +15 -0
- package/dist/dataParser/parsers/object/pick.d.ts +6 -0
- package/dist/dataParser/parsers/object/pick.mjs +13 -0
- package/dist/dataParser/parsers/optional.cjs +4 -1
- package/dist/dataParser/parsers/optional.d.ts +3 -0
- package/dist/dataParser/parsers/optional.mjs +4 -1
- package/dist/dataParser/parsers/pipe.cjs +4 -1
- package/dist/dataParser/parsers/pipe.d.ts +3 -0
- package/dist/dataParser/parsers/pipe.mjs +4 -1
- package/dist/dataParser/parsers/record/findRecordRequiredKey.cjs +17 -20
- package/dist/dataParser/parsers/record/findRecordRequiredKey.mjs +17 -20
- package/dist/dataParser/parsers/record/index.cjs +4 -1
- package/dist/dataParser/parsers/record/index.d.ts +3 -0
- package/dist/dataParser/parsers/record/index.mjs +4 -1
- package/dist/dataParser/parsers/recover.cjs +4 -1
- package/dist/dataParser/parsers/recover.d.ts +3 -0
- package/dist/dataParser/parsers/recover.mjs +4 -1
- package/dist/dataParser/parsers/string/index.cjs +4 -1
- package/dist/dataParser/parsers/string/index.d.ts +3 -0
- package/dist/dataParser/parsers/string/index.mjs +4 -1
- package/dist/dataParser/parsers/templateLiteral/createTemplateLiteralPattern.cjs +14 -17
- package/dist/dataParser/parsers/templateLiteral/createTemplateLiteralPattern.mjs +14 -17
- package/dist/dataParser/parsers/templateLiteral/index.cjs +5 -4
- package/dist/dataParser/parsers/templateLiteral/index.d.ts +3 -0
- package/dist/dataParser/parsers/templateLiteral/index.mjs +5 -4
- package/dist/dataParser/parsers/transform.cjs +4 -1
- package/dist/dataParser/parsers/transform.d.ts +3 -0
- package/dist/dataParser/parsers/transform.mjs +4 -1
- package/dist/dataParser/parsers/tuple.cjs +4 -1
- package/dist/dataParser/parsers/tuple.d.ts +3 -0
- package/dist/dataParser/parsers/tuple.mjs +4 -1
- package/dist/dataParser/parsers/union.cjs +4 -1
- package/dist/dataParser/parsers/union.d.ts +3 -0
- package/dist/dataParser/parsers/union.mjs +4 -1
- package/dist/dataParser/parsers/unknown.cjs +4 -1
- package/dist/dataParser/parsers/unknown.d.ts +3 -0
- package/dist/dataParser/parsers/unknown.mjs +4 -1
- package/dist/dataParser/types/dataParsers.d.ts +2 -2
- package/dist/date/closestTo.cjs +32 -0
- package/dist/date/closestTo.d.ts +7 -0
- package/dist/date/closestTo.mjs +30 -0
- package/dist/date/constants.cjs +29 -0
- package/dist/date/constants.d.ts +13 -0
- package/dist/date/constants.mjs +15 -0
- package/dist/date/create.cjs +50 -0
- package/dist/date/create.d.ts +16 -0
- package/dist/date/create.mjs +48 -0
- package/dist/date/createOrThrow.cjs +25 -0
- package/dist/date/createOrThrow.d.ts +10 -0
- package/dist/date/createOrThrow.mjs +22 -0
- package/dist/date/each.cjs +47 -0
- package/dist/date/each.d.ts +5 -0
- package/dist/date/each.mjs +45 -0
- package/dist/date/getters/getDayOfMonth.cjs +17 -0
- package/dist/date/getters/getDayOfMonth.d.ts +2 -0
- package/dist/date/getters/getDayOfMonth.mjs +15 -0
- package/dist/date/getters/getDayOfWeek.cjs +27 -0
- package/dist/date/getters/getDayOfWeek.d.ts +2 -0
- package/dist/date/getters/getDayOfWeek.mjs +25 -0
- package/dist/date/getters/getDayOfYear.cjs +34 -0
- package/dist/date/getters/getDayOfYear.d.ts +2 -0
- package/dist/date/getters/getDayOfYear.mjs +32 -0
- package/dist/date/getters/getFirstDayOfMonth.cjs +14 -0
- package/dist/date/getters/getFirstDayOfMonth.d.ts +2 -0
- package/dist/date/getters/getFirstDayOfMonth.mjs +12 -0
- package/dist/date/getters/getFirstDayOfWeek.cjs +16 -0
- package/dist/date/getters/getFirstDayOfWeek.d.ts +2 -0
- package/dist/date/getters/getFirstDayOfWeek.mjs +14 -0
- package/dist/date/getters/getHour.cjs +18 -0
- package/dist/date/getters/getHour.d.ts +2 -0
- package/dist/date/getters/getHour.mjs +16 -0
- package/dist/date/getters/getLastDayOfMonth.cjs +14 -0
- package/dist/date/getters/getLastDayOfMonth.d.ts +2 -0
- package/dist/date/getters/getLastDayOfMonth.mjs +12 -0
- package/dist/date/getters/getLastDayOfWeek.cjs +16 -0
- package/dist/date/getters/getLastDayOfWeek.d.ts +2 -0
- package/dist/date/getters/getLastDayOfWeek.mjs +14 -0
- package/dist/date/getters/getMilliseconds.cjs +10 -0
- package/dist/date/getters/getMilliseconds.d.ts +2 -0
- package/dist/date/getters/getMilliseconds.mjs +8 -0
- package/dist/date/getters/getMinute.cjs +17 -0
- package/dist/date/getters/getMinute.d.ts +2 -0
- package/dist/date/getters/getMinute.mjs +15 -0
- package/dist/date/getters/getMonth.cjs +17 -0
- package/dist/date/getters/getMonth.d.ts +2 -0
- package/dist/date/getters/getMonth.mjs +15 -0
- package/dist/date/getters/getSecond.cjs +17 -0
- package/dist/date/getters/getSecond.d.ts +2 -0
- package/dist/date/getters/getSecond.mjs +15 -0
- package/dist/date/getters/getWeekOfYear.cjs +37 -0
- package/dist/date/getters/getWeekOfYear.d.ts +2 -0
- package/dist/date/getters/getWeekOfYear.mjs +35 -0
- package/dist/date/getters/getYear.cjs +17 -0
- package/dist/date/getters/getYear.d.ts +2 -0
- package/dist/date/getters/getYear.mjs +15 -0
- package/dist/date/getters/index.d.ts +15 -0
- package/dist/date/index.cjs +121 -0
- package/dist/date/index.d.ts +18 -0
- package/dist/date/index.mjs +51 -0
- package/dist/date/isSafeTimestamp.cjs +15 -0
- package/dist/date/isSafeTimestamp.d.ts +1 -0
- package/dist/date/isSafeTimestamp.mjs +13 -0
- package/dist/date/now.cjs +8 -0
- package/dist/date/now.d.ts +1 -0
- package/dist/date/now.mjs +6 -0
- package/dist/date/operators/addDays.cjs +20 -0
- package/dist/date/operators/addDays.d.ts +4 -0
- package/dist/date/operators/addDays.mjs +18 -0
- package/dist/date/operators/addHours.cjs +20 -0
- package/dist/date/operators/addHours.d.ts +4 -0
- package/dist/date/operators/addHours.mjs +18 -0
- package/dist/date/operators/addMilliseconds.cjs +19 -0
- package/dist/date/operators/addMilliseconds.d.ts +4 -0
- package/dist/date/operators/addMilliseconds.mjs +17 -0
- package/dist/date/operators/addMinutes.cjs +20 -0
- package/dist/date/operators/addMinutes.d.ts +4 -0
- package/dist/date/operators/addMinutes.mjs +18 -0
- package/dist/date/operators/addMonths.cjs +19 -0
- package/dist/date/operators/addMonths.d.ts +4 -0
- package/dist/date/operators/addMonths.mjs +17 -0
- package/dist/date/operators/addSeconds.cjs +20 -0
- package/dist/date/operators/addSeconds.d.ts +4 -0
- package/dist/date/operators/addSeconds.mjs +18 -0
- package/dist/date/operators/addWeeks.cjs +20 -0
- package/dist/date/operators/addWeeks.d.ts +4 -0
- package/dist/date/operators/addWeeks.mjs +18 -0
- package/dist/date/operators/addYears.cjs +19 -0
- package/dist/date/operators/addYears.d.ts +4 -0
- package/dist/date/operators/addYears.mjs +17 -0
- package/dist/date/operators/between.cjs +17 -0
- package/dist/date/operators/between.d.ts +3 -0
- package/dist/date/operators/between.mjs +15 -0
- package/dist/date/operators/betweenThan.cjs +17 -0
- package/dist/date/operators/betweenThan.d.ts +3 -0
- package/dist/date/operators/betweenThan.mjs +15 -0
- package/dist/date/operators/greater.cjs +16 -0
- package/dist/date/operators/greater.d.ts +3 -0
- package/dist/date/operators/greater.mjs +14 -0
- package/dist/date/operators/greaterThan.cjs +16 -0
- package/dist/date/operators/greaterThan.d.ts +3 -0
- package/dist/date/operators/greaterThan.mjs +14 -0
- package/dist/date/operators/index.d.ts +22 -0
- package/dist/date/operators/less.cjs +16 -0
- package/dist/date/operators/less.d.ts +3 -0
- package/dist/date/operators/less.mjs +14 -0
- package/dist/date/operators/lessThan.cjs +16 -0
- package/dist/date/operators/lessThan.d.ts +3 -0
- package/dist/date/operators/lessThan.mjs +14 -0
- package/dist/date/operators/subtractDays.cjs +20 -0
- package/dist/date/operators/subtractDays.d.ts +4 -0
- package/dist/date/operators/subtractDays.mjs +18 -0
- package/dist/date/operators/subtractHours.cjs +20 -0
- package/dist/date/operators/subtractHours.d.ts +4 -0
- package/dist/date/operators/subtractHours.mjs +18 -0
- package/dist/date/operators/subtractMilliseconds.cjs +19 -0
- package/dist/date/operators/subtractMilliseconds.d.ts +4 -0
- package/dist/date/operators/subtractMilliseconds.mjs +17 -0
- package/dist/date/operators/subtractMinutes.cjs +20 -0
- package/dist/date/operators/subtractMinutes.d.ts +4 -0
- package/dist/date/operators/subtractMinutes.mjs +18 -0
- package/dist/date/operators/subtractMonths.cjs +19 -0
- package/dist/date/operators/subtractMonths.d.ts +4 -0
- package/dist/date/operators/subtractMonths.mjs +17 -0
- package/dist/date/operators/subtractSeconds.cjs +20 -0
- package/dist/date/operators/subtractSeconds.d.ts +4 -0
- package/dist/date/operators/subtractSeconds.mjs +18 -0
- package/dist/date/operators/subtractWeeks.cjs +20 -0
- package/dist/date/operators/subtractWeeks.d.ts +4 -0
- package/dist/date/operators/subtractWeeks.mjs +18 -0
- package/dist/date/operators/subtractYears.cjs +19 -0
- package/dist/date/operators/subtractYears.d.ts +4 -0
- package/dist/date/operators/subtractYears.mjs +17 -0
- package/dist/date/round.cjs +23 -0
- package/dist/date/round.d.ts +3 -0
- package/dist/date/round.mjs +21 -0
- package/dist/date/toISOString.cjs +10 -0
- package/dist/date/toISOString.d.ts +2 -0
- package/dist/date/toISOString.mjs +8 -0
- package/dist/date/toNative.cjs +10 -0
- package/dist/date/toNative.d.ts +2 -0
- package/dist/date/toNative.mjs +8 -0
- package/dist/date/toTimestamp.cjs +31 -0
- package/dist/date/toTimestamp.d.ts +10 -0
- package/dist/date/toTimestamp.mjs +28 -0
- package/dist/date/today.cjs +8 -0
- package/dist/date/today.d.ts +1 -0
- package/dist/date/today.mjs +6 -0
- package/dist/date/tomorrow.cjs +10 -0
- package/dist/date/tomorrow.d.ts +1 -0
- package/dist/date/tomorrow.mjs +8 -0
- package/dist/date/types/index.d.ts +6 -0
- package/dist/date/types/isLeapYear.d.ts +8 -0
- package/dist/date/types/month.d.ts +9 -0
- package/dist/date/types/theDate.d.ts +1 -0
- package/dist/date/types/time.d.ts +5 -0
- package/dist/date/types/timezone.cjs +606 -0
- package/dist/date/types/timezone.d.ts +604 -0
- package/dist/date/types/timezone.mjs +604 -0
- package/dist/date/types/unit.d.ts +1 -0
- package/dist/date/yesterday.cjs +10 -0
- package/dist/date/yesterday.d.ts +1 -0
- package/dist/date/yesterday.mjs +8 -0
- package/dist/either/bool/falsy.cjs +2 -4
- package/dist/either/bool/falsy.mjs +2 -4
- package/dist/either/bool/truthy.cjs +4 -6
- package/dist/either/bool/truthy.mjs +4 -6
- package/dist/either/future/create.cjs +0 -2
- package/dist/either/future/create.mjs +0 -2
- package/dist/either/future/error.cjs +2 -4
- package/dist/either/future/error.mjs +2 -4
- package/dist/either/future/success.cjs +0 -2
- package/dist/either/future/success.mjs +0 -2
- package/dist/either/index.cjs +7 -7
- package/dist/either/index.mjs +3 -3
- package/dist/either/kind.cjs +0 -2
- package/dist/either/kind.mjs +0 -2
- package/dist/either/left/when.cjs +1 -3
- package/dist/either/left/when.mjs +1 -3
- package/dist/either/nullable/empty.cjs +3 -5
- package/dist/either/nullable/empty.mjs +3 -5
- package/dist/either/nullable/filled.cjs +4 -6
- package/dist/either/nullable/filled.mjs +4 -6
- package/dist/either/nullish/empty.cjs +3 -5
- package/dist/either/nullish/empty.mjs +3 -5
- package/dist/either/nullish/filled.cjs +3 -5
- package/dist/either/nullish/filled.mjs +3 -5
- package/dist/either/optional/empty.cjs +0 -2
- package/dist/either/optional/empty.mjs +0 -2
- package/dist/either/optional/filled.cjs +4 -6
- package/dist/either/optional/filled.mjs +4 -6
- package/dist/either/right/asyncPipe.cjs +2 -4
- package/dist/either/right/asyncPipe.d.ts +5 -0
- package/dist/either/right/asyncPipe.mjs +2 -4
- package/dist/either/right/pipe.cjs +1 -3
- package/dist/either/right/pipe.d.ts +5 -0
- package/dist/either/right/pipe.mjs +1 -3
- package/dist/either/right/when.cjs +1 -3
- package/dist/either/right/when.mjs +1 -3
- package/dist/either/whenHasInformation.cjs +1 -3
- package/dist/either/whenHasInformation.mjs +1 -3
- package/dist/generator/asyncReduce.cjs +0 -2
- package/dist/generator/asyncReduce.mjs +0 -2
- package/dist/generator/reduce.cjs +0 -2
- package/dist/generator/reduce.mjs +0 -2
- package/dist/index.cjs +39 -30
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +36 -30
- package/dist/number/between.cjs +12 -0
- package/dist/number/between.d.ts +2 -0
- package/dist/number/between.mjs +10 -0
- package/dist/number/betweenThan.cjs +12 -0
- package/dist/number/betweenThan.d.ts +2 -0
- package/dist/number/betweenThan.mjs +10 -0
- package/dist/number/index.cjs +4 -0
- package/dist/number/index.d.ts +3 -0
- package/dist/number/index.mjs +2 -0
- package/dist/number/types/index.d.ts +1 -0
- package/dist/number/types/positiveNumber.d.ts +1 -0
- package/dist/object/deepDiscriminate.cjs +1 -3
- package/dist/object/deepDiscriminate.mjs +1 -3
- package/dist/object/discriminate.cjs +0 -2
- package/dist/object/discriminate.mjs +0 -2
- package/dist/object/entries.cjs +1 -3
- package/dist/object/entries.mjs +1 -3
- package/dist/object/entry.d.ts +2 -2
- package/dist/object/fromEntries.d.ts +5 -3
- package/dist/object/keys.cjs +1 -3
- package/dist/object/keys.mjs +1 -3
- package/dist/object/values.cjs +1 -3
- package/dist/object/values.mjs +1 -3
- package/dist/pattern/exhaustive.cjs +0 -2
- package/dist/pattern/exhaustive.mjs +0 -2
- package/dist/pattern/index.cjs +7 -4
- package/dist/pattern/index.mjs +3 -2
- package/dist/pattern/match/builder.cjs +56 -0
- package/dist/pattern/match/builder.d.ts +30 -0
- package/dist/pattern/match/builder.mjs +53 -0
- package/dist/pattern/match/index.cjs +28 -0
- package/dist/pattern/{match.d.ts → match/index.d.ts} +7 -4
- package/dist/pattern/match/index.mjs +25 -0
- package/dist/pattern/otherwise.cjs +1 -3
- package/dist/pattern/otherwise.mjs +1 -3
- package/dist/pattern/result.cjs +0 -2
- package/dist/pattern/result.mjs +0 -2
- package/dist/pattern/types/complexUnMatchedValue/array.d.ts +1 -1
- package/dist/string/index.cjs +12 -12
- package/dist/string/index.mjs +6 -6
- package/dist/string/replace.cjs +15 -0
- package/dist/string/replace.d.ts +10 -2
- package/dist/string/replace.mjs +15 -0
- package/package.json +7 -1
- package/dist/pattern/match.cjs +0 -18
- package/dist/pattern/match.mjs +0 -16
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var index = require('./array/index.cjs');
|
|
4
|
+
var index$1 = require('./number/index.cjs');
|
|
5
|
+
var index$2 = require('./either/index.cjs');
|
|
6
|
+
var index$3 = require('./object/index.cjs');
|
|
7
|
+
var index$4 = require('./string/index.cjs');
|
|
8
|
+
var index$5 = require('./generator/index.cjs');
|
|
9
|
+
var index$6 = require('./pattern/index.cjs');
|
|
10
|
+
var index$7 = require('./dataParser/index.cjs');
|
|
11
|
+
var index$8 = require('./dataParser/parsers/coerce/index.cjs');
|
|
12
|
+
var index$9 = require('./dataParser/extended/index.cjs');
|
|
13
|
+
var index$a = require('./date/index.cjs');
|
|
3
14
|
var addWrappedProperties = require('./common/addWrappedProperties.cjs');
|
|
4
15
|
var asyncPipe = require('./common/asyncPipe.cjs');
|
|
5
16
|
var clone = require('./common/clone.cjs');
|
|
@@ -40,19 +51,34 @@ var instanceOf = require('./common/instanceOf.cjs');
|
|
|
40
51
|
var globalStore = require('./common/globalStore.cjs');
|
|
41
52
|
var builder = require('./common/builder.cjs');
|
|
42
53
|
var createKindIdentifier = require('./common/createKindIdentifier.cjs');
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var index$3 = require('./object/index.cjs');
|
|
47
|
-
var index$4 = require('./string/index.cjs');
|
|
48
|
-
var index$5 = require('./generator/index.cjs');
|
|
49
|
-
var index$6 = require('./pattern/index.cjs');
|
|
50
|
-
var index$7 = require('./dataParser/index.cjs');
|
|
51
|
-
var index$8 = require('./dataParser/parsers/coerce/index.cjs');
|
|
52
|
-
var index$9 = require('./dataParser/extended/index.cjs');
|
|
54
|
+
var forwardLog = require('./common/forwardLog.cjs');
|
|
55
|
+
var override = require('./common/override.cjs');
|
|
56
|
+
var errorKindNamespace = require('./common/errorKindNamespace.cjs');
|
|
53
57
|
|
|
54
58
|
|
|
55
59
|
|
|
60
|
+
exports.A = index;
|
|
61
|
+
exports.DArray = index;
|
|
62
|
+
exports.DNumber = index$1;
|
|
63
|
+
exports.N = index$1;
|
|
64
|
+
exports.DEither = index$2;
|
|
65
|
+
exports.E = index$2;
|
|
66
|
+
exports.DObject = index$3;
|
|
67
|
+
exports.O = index$3;
|
|
68
|
+
exports.DString = index$4;
|
|
69
|
+
exports.S = index$4;
|
|
70
|
+
exports.DGenerator = index$5;
|
|
71
|
+
exports.G = index$5;
|
|
72
|
+
exports.DPattern = index$6;
|
|
73
|
+
exports.P = index$6;
|
|
74
|
+
exports.DDataParser = index$7;
|
|
75
|
+
exports.DP = index$7;
|
|
76
|
+
exports.DDataParserCoerce = index$8;
|
|
77
|
+
exports.DPC = index$8;
|
|
78
|
+
exports.DDataParserExtended = index$9;
|
|
79
|
+
exports.DPE = index$9;
|
|
80
|
+
exports.D = index$a;
|
|
81
|
+
exports.DDate = index$a;
|
|
56
82
|
exports.addWrappedProperties = addWrappedProperties.addWrappedProperties;
|
|
57
83
|
exports.asyncPipe = asyncPipe.asyncPipe;
|
|
58
84
|
exports.clone = clone.clone;
|
|
@@ -105,23 +131,6 @@ exports.MissingBuilderMethodsError = builder.MissingBuilderMethodsError;
|
|
|
105
131
|
exports.builderKind = builder.builderKind;
|
|
106
132
|
exports.createBuilder = builder.createBuilder;
|
|
107
133
|
exports.createKindIdentifier = createKindIdentifier.createKindIdentifier;
|
|
108
|
-
exports.
|
|
109
|
-
exports.
|
|
110
|
-
exports.
|
|
111
|
-
exports.N = index$1;
|
|
112
|
-
exports.DEither = index$2;
|
|
113
|
-
exports.E = index$2;
|
|
114
|
-
exports.DObject = index$3;
|
|
115
|
-
exports.O = index$3;
|
|
116
|
-
exports.DString = index$4;
|
|
117
|
-
exports.S = index$4;
|
|
118
|
-
exports.DGenerator = index$5;
|
|
119
|
-
exports.G = index$5;
|
|
120
|
-
exports.DPattern = index$6;
|
|
121
|
-
exports.P = index$6;
|
|
122
|
-
exports.DDataParser = index$7;
|
|
123
|
-
exports.DP = index$7;
|
|
124
|
-
exports.DDataParserCoerce = index$8;
|
|
125
|
-
exports.DPC = index$8;
|
|
126
|
-
exports.DDataParserExtended = index$9;
|
|
127
|
-
exports.DPE = index$9;
|
|
134
|
+
exports.forwardLog = forwardLog.forwardLog;
|
|
135
|
+
exports.createOverride = override.createOverride;
|
|
136
|
+
exports.createErrorKind = errorKindNamespace.createErrorKind;
|
package/dist/index.d.ts
CHANGED
|
@@ -19,3 +19,5 @@ export * as DPC from "./dataParser/parsers/coerce";
|
|
|
19
19
|
export * as DDataParserCoerce from "./dataParser/parsers/coerce";
|
|
20
20
|
export * as DPE from "./dataParser/extended";
|
|
21
21
|
export * as DDataParserExtended from "./dataParser/extended";
|
|
22
|
+
export * as D from "./date";
|
|
23
|
+
export * as DDate from "./date";
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
import * as index from './array/index.mjs';
|
|
2
|
+
export { index as A };
|
|
3
|
+
export { index as DArray };
|
|
4
|
+
import * as index$1 from './number/index.mjs';
|
|
5
|
+
export { index$1 as DNumber };
|
|
6
|
+
export { index$1 as N };
|
|
7
|
+
import * as index$2 from './either/index.mjs';
|
|
8
|
+
export { index$2 as DEither };
|
|
9
|
+
export { index$2 as E };
|
|
10
|
+
import * as index$3 from './object/index.mjs';
|
|
11
|
+
export { index$3 as DObject };
|
|
12
|
+
export { index$3 as O };
|
|
13
|
+
import * as index$4 from './string/index.mjs';
|
|
14
|
+
export { index$4 as DString };
|
|
15
|
+
export { index$4 as S };
|
|
16
|
+
import * as index$5 from './generator/index.mjs';
|
|
17
|
+
export { index$5 as DGenerator };
|
|
18
|
+
export { index$5 as G };
|
|
19
|
+
import * as index$6 from './pattern/index.mjs';
|
|
20
|
+
export { index$6 as DPattern };
|
|
21
|
+
export { index$6 as P };
|
|
22
|
+
import * as index$7 from './dataParser/index.mjs';
|
|
23
|
+
export { index$7 as DDataParser };
|
|
24
|
+
export { index$7 as DP };
|
|
25
|
+
import * as index$8 from './dataParser/parsers/coerce/index.mjs';
|
|
26
|
+
export { index$8 as DDataParserCoerce };
|
|
27
|
+
export { index$8 as DPC };
|
|
28
|
+
import * as index$9 from './dataParser/extended/index.mjs';
|
|
29
|
+
export { index$9 as DDataParserExtended };
|
|
30
|
+
export { index$9 as DPE };
|
|
31
|
+
import * as index$a from './date/index.mjs';
|
|
32
|
+
export { index$a as D };
|
|
33
|
+
export { index$a as DDate };
|
|
1
34
|
export { addWrappedProperties } from './common/addWrappedProperties.mjs';
|
|
2
35
|
export { asyncPipe } from './common/asyncPipe.mjs';
|
|
3
36
|
export { clone } from './common/clone.mjs';
|
|
@@ -38,33 +71,6 @@ export { instanceOf } from './common/instanceOf.mjs';
|
|
|
38
71
|
export { createGlobalStore } from './common/globalStore.mjs';
|
|
39
72
|
export { MissingBuilderMethodsError, builderKind, createBuilder } from './common/builder.mjs';
|
|
40
73
|
export { createKindIdentifier } from './common/createKindIdentifier.mjs';
|
|
41
|
-
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
44
|
-
import * as index$1 from './number/index.mjs';
|
|
45
|
-
export { index$1 as DNumber };
|
|
46
|
-
export { index$1 as N };
|
|
47
|
-
import * as index$2 from './either/index.mjs';
|
|
48
|
-
export { index$2 as DEither };
|
|
49
|
-
export { index$2 as E };
|
|
50
|
-
import * as index$3 from './object/index.mjs';
|
|
51
|
-
export { index$3 as DObject };
|
|
52
|
-
export { index$3 as O };
|
|
53
|
-
import * as index$4 from './string/index.mjs';
|
|
54
|
-
export { index$4 as DString };
|
|
55
|
-
export { index$4 as S };
|
|
56
|
-
import * as index$5 from './generator/index.mjs';
|
|
57
|
-
export { index$5 as DGenerator };
|
|
58
|
-
export { index$5 as G };
|
|
59
|
-
import * as index$6 from './pattern/index.mjs';
|
|
60
|
-
export { index$6 as DPattern };
|
|
61
|
-
export { index$6 as P };
|
|
62
|
-
import * as index$7 from './dataParser/index.mjs';
|
|
63
|
-
export { index$7 as DDataParser };
|
|
64
|
-
export { index$7 as DP };
|
|
65
|
-
import * as index$8 from './dataParser/parsers/coerce/index.mjs';
|
|
66
|
-
export { index$8 as DDataParserCoerce };
|
|
67
|
-
export { index$8 as DPC };
|
|
68
|
-
import * as index$9 from './dataParser/extended/index.mjs';
|
|
69
|
-
export { index$9 as DDataParserExtended };
|
|
70
|
-
export { index$9 as DPE };
|
|
74
|
+
export { forwardLog } from './common/forwardLog.mjs';
|
|
75
|
+
export { createOverride } from './common/override.mjs';
|
|
76
|
+
export { createErrorKind } from './common/errorKindNamespace.mjs';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function between(...args) {
|
|
4
|
+
if (args.length === 2) {
|
|
5
|
+
const [greater, less] = args;
|
|
6
|
+
return (input) => between(input, greater, less);
|
|
7
|
+
}
|
|
8
|
+
const [input, greater, less] = args;
|
|
9
|
+
return input >= greater && input <= less;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.between = between;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function betweenThan(...args) {
|
|
4
|
+
if (args.length === 2) {
|
|
5
|
+
const [greaterThan, lessThan] = args;
|
|
6
|
+
return (input) => betweenThan(input, greaterThan, lessThan);
|
|
7
|
+
}
|
|
8
|
+
const [input, greaterThan, lessThan] = args;
|
|
9
|
+
return input > greaterThan && input < lessThan;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.betweenThan = betweenThan;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function betweenThan(...args) {
|
|
2
|
+
if (args.length === 2) {
|
|
3
|
+
const [greaterThan, lessThan] = args;
|
|
4
|
+
return (input) => betweenThan(input, greaterThan, lessThan);
|
|
5
|
+
}
|
|
6
|
+
const [input, greaterThan, lessThan] = args;
|
|
7
|
+
return input > greaterThan && input < lessThan;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { betweenThan };
|
package/dist/number/index.cjs
CHANGED
|
@@ -28,6 +28,8 @@ var greaterThan = require('./greaterThan.cjs');
|
|
|
28
28
|
var lessThan = require('./lessThan.cjs');
|
|
29
29
|
var toFixed = require('./toFixed.cjs');
|
|
30
30
|
var sqrt = require('./sqrt.cjs');
|
|
31
|
+
var between = require('./between.cjs');
|
|
32
|
+
var betweenThan = require('./betweenThan.cjs');
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
|
|
@@ -59,3 +61,5 @@ exports.greaterThan = greaterThan.greaterThan;
|
|
|
59
61
|
exports.lessThan = lessThan.lessThan;
|
|
60
62
|
exports.toFixed = toFixed.toFixed;
|
|
61
63
|
exports.sqrt = sqrt.sqrt;
|
|
64
|
+
exports.between = between.between;
|
|
65
|
+
exports.betweenThan = betweenThan.betweenThan;
|
package/dist/number/index.d.ts
CHANGED
package/dist/number/index.mjs
CHANGED
|
@@ -26,3 +26,5 @@ export { greaterThan } from './greaterThan.mjs';
|
|
|
26
26
|
export { lessThan } from './lessThan.mjs';
|
|
27
27
|
export { toFixed } from './toFixed.mjs';
|
|
28
28
|
export { sqrt } from './sqrt.mjs';
|
|
29
|
+
export { between } from './between.mjs';
|
|
30
|
+
export { betweenThan } from './betweenThan.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./positiveNumber";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PositiveNumber<GenericNumber extends number> = `${GenericNumber}` extends `-${string}` | "0" ? never : GenericNumber;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var equal = require('../common/equal.cjs');
|
|
4
3
|
var getDeepProperty = require('./getDeepProperty.cjs');
|
|
5
|
-
require('../common/
|
|
6
|
-
require('../common/builder.cjs');
|
|
4
|
+
var equal = require('../common/equal.cjs');
|
|
7
5
|
|
|
8
6
|
function deepDiscriminate(...args) {
|
|
9
7
|
if (args.length === 2) {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { equal } from '../common/equal.mjs';
|
|
2
1
|
import { getDeepProperty } from './getDeepProperty.mjs';
|
|
3
|
-
import '../common/
|
|
4
|
-
import '../common/builder.mjs';
|
|
2
|
+
import { equal } from '../common/equal.mjs';
|
|
5
3
|
|
|
6
4
|
function deepDiscriminate(...args) {
|
|
7
5
|
if (args.length === 2) {
|
package/dist/object/entries.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('../common/kind.cjs');
|
|
4
3
|
var wrapValue = require('../common/wrapValue.cjs');
|
|
5
|
-
require('../common/
|
|
6
|
-
require('../common/builder.cjs');
|
|
4
|
+
var kind = require('../common/kind.cjs');
|
|
7
5
|
|
|
8
6
|
function entries(object) {
|
|
9
7
|
return Object.entries(object)
|
package/dist/object/entries.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { isRuntimeKind } from '../common/kind.mjs';
|
|
2
1
|
import { isRuntimeWrappedValueKey } from '../common/wrapValue.mjs';
|
|
3
|
-
import '../common/
|
|
4
|
-
import '../common/builder.mjs';
|
|
2
|
+
import { isRuntimeKind } from '../common/kind.mjs';
|
|
5
3
|
|
|
6
4
|
function entries(object) {
|
|
7
5
|
return Object.entries(object)
|
package/dist/object/entry.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare function entry<GenericKey extends ObjectKey, GenericValue extends
|
|
1
|
+
import { type ObjectKey } from "../common";
|
|
2
|
+
export declare function entry<GenericKey extends ObjectKey, GenericValue extends unknown>(key: GenericKey, value: GenericValue): readonly [GenericKey, GenericValue];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { type ObjectEntry, type ObjectKey, type
|
|
2
|
-
type ComputeEntries<GenericEntry extends ObjectEntry> = SimplifyTopLevel<{
|
|
1
|
+
import { type ObjectEntry, type ObjectKey, type SimplifyTopLevel, type UnionContain } from "../common";
|
|
2
|
+
type ComputeEntries<GenericEntry extends ObjectEntry> = UnionContain<ObjectKey, GenericEntry[0]> extends true ? SimplifyTopLevel<{
|
|
3
|
+
[Entry in GenericEntry as Entry[0]]: Entry[1];
|
|
4
|
+
}> : SimplifyTopLevel<{
|
|
3
5
|
[Entry in GenericEntry as Entry[0]]?: Entry[1];
|
|
4
6
|
}>;
|
|
5
|
-
export declare function fromEntries<GenericKey extends ObjectKey,
|
|
7
|
+
export declare function fromEntries<GenericKey extends ObjectKey, const GenericEntry extends readonly [GenericKey, unknown]>(entries: readonly GenericEntry[]): ComputeEntries<GenericEntry>;
|
|
6
8
|
export {};
|
package/dist/object/keys.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('../common/kind.cjs');
|
|
4
3
|
var wrapValue = require('../common/wrapValue.cjs');
|
|
5
|
-
require('../common/
|
|
6
|
-
require('../common/builder.cjs');
|
|
4
|
+
var kind = require('../common/kind.cjs');
|
|
7
5
|
|
|
8
6
|
function keys(object) {
|
|
9
7
|
return Object.keys(object)
|
package/dist/object/keys.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { isRuntimeKind } from '../common/kind.mjs';
|
|
2
1
|
import { isRuntimeWrappedValueKey } from '../common/wrapValue.mjs';
|
|
3
|
-
import '../common/
|
|
4
|
-
import '../common/builder.mjs';
|
|
2
|
+
import { isRuntimeKind } from '../common/kind.mjs';
|
|
5
3
|
|
|
6
4
|
function keys(object) {
|
|
7
5
|
return Object.keys(object)
|
package/dist/object/values.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('../common/kind.cjs');
|
|
4
3
|
var wrapValue = require('../common/wrapValue.cjs');
|
|
5
|
-
require('../common/
|
|
6
|
-
require('../common/builder.cjs');
|
|
4
|
+
var kind = require('../common/kind.cjs');
|
|
7
5
|
|
|
8
6
|
function values(object) {
|
|
9
7
|
return Object.entries(object)
|
package/dist/object/values.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { isRuntimeKind } from '../common/kind.mjs';
|
|
2
1
|
import { isRuntimeWrappedValueKey } from '../common/wrapValue.mjs';
|
|
3
|
-
import '../common/
|
|
4
|
-
import '../common/builder.mjs';
|
|
2
|
+
import { isRuntimeKind } from '../common/kind.mjs';
|
|
5
3
|
|
|
6
4
|
function values(object) {
|
|
7
5
|
return Object.entries(object)
|
package/dist/pattern/index.cjs
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
var result = require('./result.cjs');
|
|
4
4
|
var exhaustive = require('./exhaustive.cjs');
|
|
5
5
|
var otherwise = require('./otherwise.cjs');
|
|
6
|
-
var
|
|
6
|
+
var index = require('./match/index.cjs');
|
|
7
7
|
var isMatch = require('./isMatch.cjs');
|
|
8
|
-
var pattern = require('./types/pattern.cjs');
|
|
9
8
|
var union = require('./union.cjs');
|
|
10
9
|
var when = require('./when.cjs');
|
|
10
|
+
var builder = require('./match/builder.cjs');
|
|
11
|
+
var pattern = require('./types/pattern.cjs');
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
|
|
@@ -15,8 +16,10 @@ exports.isResult = result.isResult;
|
|
|
15
16
|
exports.result = result.result;
|
|
16
17
|
exports.exhaustive = exhaustive.exhaustive;
|
|
17
18
|
exports.otherwise = otherwise.otherwise;
|
|
18
|
-
exports.match =
|
|
19
|
+
exports.match = index.match;
|
|
19
20
|
exports.isMatch = isMatch.isMatch;
|
|
20
|
-
exports.SymbolToolPatternFunctionLabel = pattern.SymbolToolPatternFunctionLabel;
|
|
21
21
|
exports.union = union.union;
|
|
22
22
|
exports.when = when.when;
|
|
23
|
+
exports.InvalidExhaustivePatternError = builder.InvalidExhaustivePatternError;
|
|
24
|
+
exports.matchBuilder = builder.matchBuilder;
|
|
25
|
+
exports.SymbolToolPatternFunctionLabel = pattern.SymbolToolPatternFunctionLabel;
|
package/dist/pattern/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { isResult, result } from './result.mjs';
|
|
2
2
|
export { exhaustive } from './exhaustive.mjs';
|
|
3
3
|
export { otherwise } from './otherwise.mjs';
|
|
4
|
-
export { match } from './match.mjs';
|
|
4
|
+
export { match } from './match/index.mjs';
|
|
5
5
|
export { isMatch } from './isMatch.mjs';
|
|
6
|
-
export { SymbolToolPatternFunctionLabel } from './types/pattern.mjs';
|
|
7
6
|
export { union } from './union.mjs';
|
|
8
7
|
export { when } from './when.mjs';
|
|
8
|
+
export { InvalidExhaustivePatternError, matchBuilder } from './match/builder.mjs';
|
|
9
|
+
export { SymbolToolPatternFunctionLabel } from './types/pattern.mjs';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var isMatch = require('../isMatch.cjs');
|
|
4
|
+
var builder = require('../../common/builder.cjs');
|
|
5
|
+
var kind = require('../../common/kind.cjs');
|
|
6
|
+
var errorKindNamespace = require('../../common/errorKindNamespace.cjs');
|
|
7
|
+
|
|
8
|
+
class InvalidExhaustivePatternError extends kind.kindHeritage("invalid-exhaustive-pattern-error", errorKindNamespace.createErrorKind("invalid-exhaustive-pattern-error"), Error) {
|
|
9
|
+
input;
|
|
10
|
+
constructor(input) {
|
|
11
|
+
super({}, ["Invalid exhaustive pattern. If typing is correct, report your situation on github."]);
|
|
12
|
+
this.input = input;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const matchBuilder = builder.createBuilder("@duplojs/utils/pattern/match");
|
|
16
|
+
matchBuilder.set("with", ({ args: [pattern, theFunction], accumulator, next, }) => next({
|
|
17
|
+
...accumulator,
|
|
18
|
+
matchers: [
|
|
19
|
+
...accumulator.matchers,
|
|
20
|
+
{
|
|
21
|
+
isMatch: isMatch.isMatch(pattern),
|
|
22
|
+
theFunction,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
}));
|
|
26
|
+
matchBuilder.set("when", ({ args: [predicate, theFunction], accumulator, next, }) => next({
|
|
27
|
+
...accumulator,
|
|
28
|
+
matchers: [
|
|
29
|
+
...accumulator.matchers,
|
|
30
|
+
{
|
|
31
|
+
isMatch: predicate,
|
|
32
|
+
theFunction,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
}));
|
|
36
|
+
matchBuilder.set("exhaustive", ({ accumulator: { input, matchers, }, }) => {
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
38
|
+
for (let index = 0; index < matchers.length; index++) {
|
|
39
|
+
if (matchers[index].isMatch(input)) {
|
|
40
|
+
return matchers[index].theFunction(input);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
throw new InvalidExhaustivePatternError(input);
|
|
44
|
+
});
|
|
45
|
+
matchBuilder.set("otherwise", ({ args: [theFunction], accumulator: { input, matchers, }, }) => {
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
47
|
+
for (let index = 0; index < matchers.length; index++) {
|
|
48
|
+
if (matchers[index].isMatch(input)) {
|
|
49
|
+
return matchers[index].theFunction(input);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return theFunction(input);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
exports.InvalidExhaustivePatternError = InvalidExhaustivePatternError;
|
|
56
|
+
exports.matchBuilder = matchBuilder;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type Builder, type FixDeepFunctionInfer, type IsEqual } from "../../common";
|
|
2
|
+
import { type ComplexMatchedValue, type ComplexUnMatchedValue, type Pattern, type PatternValue } from "../types";
|
|
3
|
+
export interface BuilderMatcher {
|
|
4
|
+
isMatch(value: unknown): boolean;
|
|
5
|
+
theFunction(value: unknown): unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface MatchBuilderDefinition {
|
|
8
|
+
input: unknown;
|
|
9
|
+
matchers: BuilderMatcher[];
|
|
10
|
+
}
|
|
11
|
+
declare const SymbolErrorMatchExhaustive: unique symbol;
|
|
12
|
+
export interface MatchBuilder<GenericValue extends unknown = never, GenericResult extends unknown = never> extends Builder<MatchBuilderDefinition> {
|
|
13
|
+
with<const GenericPattern extends Pattern<GenericValue>, GenericOutput extends unknown>(pattern: FixDeepFunctionInfer<Pattern<GenericValue>, GenericPattern>, theFunction: (value: ComplexMatchedValue<GenericValue, PatternValue<GenericPattern>>) => GenericOutput): MatchBuilder<ComplexUnMatchedValue<GenericValue, PatternValue<GenericPattern>>, GenericOutput | GenericResult>;
|
|
14
|
+
when<GenericPredicatedInput extends GenericValue, GenericOutput extends unknown>(predicate: (input: GenericValue) => input is GenericPredicatedInput, theFunction: (predicatedInput: GenericPredicatedInput) => GenericOutput): MatchBuilder<Exclude<GenericValue, GenericPredicatedInput>, GenericOutput | GenericResult>;
|
|
15
|
+
when<GenericOutput extends unknown>(predicate: (input: GenericValue) => boolean, theFunction: (predicatedInput: GenericValue) => GenericOutput): MatchBuilder<GenericValue, GenericOutput | GenericResult>;
|
|
16
|
+
exhaustive: IsEqual<GenericValue, never> extends true ? () => GenericResult : {
|
|
17
|
+
[SymbolErrorMatchExhaustive]: "Pattern are not exhaustive.";
|
|
18
|
+
restValue: GenericValue;
|
|
19
|
+
};
|
|
20
|
+
otherwise<GenericOtherwiseResult extends unknown>(theFunction: (value: GenericValue) => GenericOtherwiseResult): GenericResult | GenericOtherwiseResult;
|
|
21
|
+
}
|
|
22
|
+
declare const InvalidExhaustivePatternError_base: new (params: {
|
|
23
|
+
"@DuplojsUtilsError/invalid-exhaustive-pattern-error"?: unknown;
|
|
24
|
+
}, parentParams: [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("../../common").Kind<import("../../common").KindDefinition<"invalid-exhaustive-pattern-error", unknown>, unknown> & import("../../common").Kind<import("../../common").KindDefinition<"@DuplojsUtilsError/invalid-exhaustive-pattern-error", unknown>, unknown>;
|
|
25
|
+
export declare class InvalidExhaustivePatternError extends InvalidExhaustivePatternError_base {
|
|
26
|
+
input: unknown;
|
|
27
|
+
constructor(input: unknown);
|
|
28
|
+
}
|
|
29
|
+
export declare const matchBuilder: import("../../common").BuilderHandler<MatchBuilder<unknown, unknown> & Pick<MatchBuilder<never, unknown>, "exhaustive">>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { isMatch } from '../isMatch.mjs';
|
|
2
|
+
import { createBuilder } from '../../common/builder.mjs';
|
|
3
|
+
import { kindHeritage } from '../../common/kind.mjs';
|
|
4
|
+
import { createErrorKind } from '../../common/errorKindNamespace.mjs';
|
|
5
|
+
|
|
6
|
+
class InvalidExhaustivePatternError extends kindHeritage("invalid-exhaustive-pattern-error", createErrorKind("invalid-exhaustive-pattern-error"), Error) {
|
|
7
|
+
input;
|
|
8
|
+
constructor(input) {
|
|
9
|
+
super({}, ["Invalid exhaustive pattern. If typing is correct, report your situation on github."]);
|
|
10
|
+
this.input = input;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const matchBuilder = createBuilder("@duplojs/utils/pattern/match");
|
|
14
|
+
matchBuilder.set("with", ({ args: [pattern, theFunction], accumulator, next, }) => next({
|
|
15
|
+
...accumulator,
|
|
16
|
+
matchers: [
|
|
17
|
+
...accumulator.matchers,
|
|
18
|
+
{
|
|
19
|
+
isMatch: isMatch(pattern),
|
|
20
|
+
theFunction,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
}));
|
|
24
|
+
matchBuilder.set("when", ({ args: [predicate, theFunction], accumulator, next, }) => next({
|
|
25
|
+
...accumulator,
|
|
26
|
+
matchers: [
|
|
27
|
+
...accumulator.matchers,
|
|
28
|
+
{
|
|
29
|
+
isMatch: predicate,
|
|
30
|
+
theFunction,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
}));
|
|
34
|
+
matchBuilder.set("exhaustive", ({ accumulator: { input, matchers, }, }) => {
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
36
|
+
for (let index = 0; index < matchers.length; index++) {
|
|
37
|
+
if (matchers[index].isMatch(input)) {
|
|
38
|
+
return matchers[index].theFunction(input);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
throw new InvalidExhaustivePatternError(input);
|
|
42
|
+
});
|
|
43
|
+
matchBuilder.set("otherwise", ({ args: [theFunction], accumulator: { input, matchers, }, }) => {
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
45
|
+
for (let index = 0; index < matchers.length; index++) {
|
|
46
|
+
if (matchers[index].isMatch(input)) {
|
|
47
|
+
return matchers[index].theFunction(input);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return theFunction(input);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export { InvalidExhaustivePatternError, matchBuilder };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var result = require('../result.cjs');
|
|
4
|
+
var isMatch = require('../isMatch.cjs');
|
|
5
|
+
var builder = require('./builder.cjs');
|
|
6
|
+
|
|
7
|
+
function match(...args) {
|
|
8
|
+
if (args.length === 1) {
|
|
9
|
+
const [input] = args;
|
|
10
|
+
return builder.matchBuilder.use({
|
|
11
|
+
input,
|
|
12
|
+
matchers: [],
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
if (args.length === 2) {
|
|
16
|
+
const [pattern, theFunction] = args;
|
|
17
|
+
return (input) => match(input, pattern, theFunction);
|
|
18
|
+
}
|
|
19
|
+
const [input, pattern, theFunction] = args;
|
|
20
|
+
if (!result.isResult(input) && isMatch.isMatch(input, pattern)) {
|
|
21
|
+
return result.result(theFunction(input));
|
|
22
|
+
}
|
|
23
|
+
return input;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.InvalidExhaustivePatternError = builder.InvalidExhaustivePatternError;
|
|
27
|
+
exports.matchBuilder = builder.matchBuilder;
|
|
28
|
+
exports.match = match;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { type IsEqual, type AnyValue, type EscapeVoid, type FixDeepFunctionInfer, type BreakGenericLink } from "
|
|
2
|
-
import { type PatternValue, type Pattern } from "
|
|
3
|
-
import { type PatternResult } from "
|
|
4
|
-
import { type ComplexMatchedValue, type ComplexUnMatchedValue } from "
|
|
1
|
+
import { type IsEqual, type AnyValue, type EscapeVoid, type FixDeepFunctionInfer, type BreakGenericLink } from "../../common";
|
|
2
|
+
import { type PatternValue, type Pattern } from "../types/pattern";
|
|
3
|
+
import { type PatternResult } from "../result";
|
|
4
|
+
import { type ComplexMatchedValue, type ComplexUnMatchedValue } from "../types";
|
|
5
|
+
import { type MatchBuilder } from "./builder";
|
|
6
|
+
export * from "./builder";
|
|
7
|
+
export declare function match<GenericInput extends AnyValue>(input: GenericInput): MatchBuilder<GenericInput>;
|
|
5
8
|
export declare function match<GenericInput extends AnyValue, GenericInputValue extends Exclude<GenericInput, PatternResult>, GenericInputPatternResult extends Extract<GenericInput, PatternResult>, const GenericPattern extends Pattern<GenericInputValue>, GenericPatternValue extends PatternValue<GenericPattern>, GenericOutput extends AnyValue | EscapeVoid, GenericMatchedValue extends Extract<ComplexMatchedValue<GenericInputValue, GenericPatternValue>, any>>(pattern: FixDeepFunctionInfer<Pattern<GenericInputValue>, GenericPattern>, theFunction: (value: Extract<ComplexMatchedValue<GenericInputValue, PatternValue<GenericPattern>>, any>) => GenericOutput): (input: GenericInput | GenericInputValue | GenericInputPatternResult) => ((IsEqual<GenericMatchedValue, never> extends true ? never : PatternResult<GenericOutput>) | GenericInputPatternResult | (Extract<ComplexUnMatchedValue<GenericInputValue, GenericPatternValue>, any> extends infer InferredResult ? BreakGenericLink<InferredResult> : never));
|
|
6
9
|
export declare function match<GenericInput extends AnyValue, GenericInputValue extends Exclude<GenericInput, PatternResult>, GenericInputPatternResult extends Extract<GenericInput, PatternResult>, const GenericPattern extends Pattern<GenericInputValue>, GenericPatternValue extends PatternValue<GenericPattern>, GenericOutput extends AnyValue | EscapeVoid, GenericMatchedValue extends Extract<ComplexMatchedValue<GenericInputValue, GenericPatternValue>, any>>(input: GenericInput | GenericInputValue | GenericInputPatternResult, pattern: FixDeepFunctionInfer<Pattern<GenericInputValue>, GenericPattern>, theFunction: (value: Extract<ComplexMatchedValue<GenericInputValue, PatternValue<GenericPattern>>, any>) => GenericOutput): ((IsEqual<GenericMatchedValue, never> extends true ? never : PatternResult<GenericOutput>) | GenericInputPatternResult | Extract<ComplexUnMatchedValue<GenericInputValue, GenericPatternValue>, any>);
|