@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
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constants = require('./constants.cjs');
|
|
4
|
+
var create = require('./create.cjs');
|
|
5
|
+
var now = require('./now.cjs');
|
|
6
|
+
var today = require('./today.cjs');
|
|
7
|
+
var yesterday = require('./yesterday.cjs');
|
|
8
|
+
var tomorrow = require('./tomorrow.cjs');
|
|
9
|
+
var toNative = require('./toNative.cjs');
|
|
10
|
+
var toTimestamp = require('./toTimestamp.cjs');
|
|
11
|
+
var toISOString = require('./toISOString.cjs');
|
|
12
|
+
var closestTo = require('./closestTo.cjs');
|
|
13
|
+
var each = require('./each.cjs');
|
|
14
|
+
var createOrThrow = require('./createOrThrow.cjs');
|
|
15
|
+
var round = require('./round.cjs');
|
|
16
|
+
var isSafeTimestamp = require('./isSafeTimestamp.cjs');
|
|
17
|
+
var timezone = require('./types/timezone.cjs');
|
|
18
|
+
var getDayOfMonth = require('./getters/getDayOfMonth.cjs');
|
|
19
|
+
var getDayOfWeek = require('./getters/getDayOfWeek.cjs');
|
|
20
|
+
var getFirstDayOfWeek = require('./getters/getFirstDayOfWeek.cjs');
|
|
21
|
+
var getLastDayOfWeek = require('./getters/getLastDayOfWeek.cjs');
|
|
22
|
+
var getFirstDayOfMonth = require('./getters/getFirstDayOfMonth.cjs');
|
|
23
|
+
var getLastDayOfMonth = require('./getters/getLastDayOfMonth.cjs');
|
|
24
|
+
var getHour = require('./getters/getHour.cjs');
|
|
25
|
+
var getMilliseconds = require('./getters/getMilliseconds.cjs');
|
|
26
|
+
var getMinute = require('./getters/getMinute.cjs');
|
|
27
|
+
var getMonth = require('./getters/getMonth.cjs');
|
|
28
|
+
var getSecond = require('./getters/getSecond.cjs');
|
|
29
|
+
var getYear = require('./getters/getYear.cjs');
|
|
30
|
+
var getDayOfYear = require('./getters/getDayOfYear.cjs');
|
|
31
|
+
var getWeekOfYear = require('./getters/getWeekOfYear.cjs');
|
|
32
|
+
var addDays = require('./operators/addDays.cjs');
|
|
33
|
+
var addHours = require('./operators/addHours.cjs');
|
|
34
|
+
var addMilliseconds = require('./operators/addMilliseconds.cjs');
|
|
35
|
+
var addMinutes = require('./operators/addMinutes.cjs');
|
|
36
|
+
var addMonths = require('./operators/addMonths.cjs');
|
|
37
|
+
var addSeconds = require('./operators/addSeconds.cjs');
|
|
38
|
+
var addWeeks = require('./operators/addWeeks.cjs');
|
|
39
|
+
var addYears = require('./operators/addYears.cjs');
|
|
40
|
+
var subtractDays = require('./operators/subtractDays.cjs');
|
|
41
|
+
var subtractHours = require('./operators/subtractHours.cjs');
|
|
42
|
+
var subtractMilliseconds = require('./operators/subtractMilliseconds.cjs');
|
|
43
|
+
var subtractMinutes = require('./operators/subtractMinutes.cjs');
|
|
44
|
+
var subtractMonths = require('./operators/subtractMonths.cjs');
|
|
45
|
+
var subtractSeconds = require('./operators/subtractSeconds.cjs');
|
|
46
|
+
var subtractWeeks = require('./operators/subtractWeeks.cjs');
|
|
47
|
+
var subtractYears = require('./operators/subtractYears.cjs');
|
|
48
|
+
var between = require('./operators/between.cjs');
|
|
49
|
+
var betweenThan = require('./operators/betweenThan.cjs');
|
|
50
|
+
var greater = require('./operators/greater.cjs');
|
|
51
|
+
var greaterThan = require('./operators/greaterThan.cjs');
|
|
52
|
+
var less = require('./operators/less.cjs');
|
|
53
|
+
var lessThan = require('./operators/lessThan.cjs');
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
exports.daysInOneWeek = constants.daysInOneWeek;
|
|
58
|
+
exports.hoursInOneDay = constants.hoursInOneDay;
|
|
59
|
+
exports.maxTimestamp = constants.maxTimestamp;
|
|
60
|
+
exports.millisecondInOneHour = constants.millisecondInOneHour;
|
|
61
|
+
exports.millisecondInOneMinute = constants.millisecondInOneMinute;
|
|
62
|
+
exports.millisecondInOneWeek = constants.millisecondInOneWeek;
|
|
63
|
+
exports.millisecondsInOneDay = constants.millisecondsInOneDay;
|
|
64
|
+
exports.millisecondsInOneSecond = constants.millisecondsInOneSecond;
|
|
65
|
+
exports.minTimestamp = constants.minTimestamp;
|
|
66
|
+
exports.minutesInOneHour = constants.minutesInOneHour;
|
|
67
|
+
exports.monthtsInOneYear = constants.monthtsInOneYear;
|
|
68
|
+
exports.secondsInOneMinute = constants.secondsInOneMinute;
|
|
69
|
+
exports.theDateRegex = constants.theDateRegex;
|
|
70
|
+
exports.create = create.create;
|
|
71
|
+
exports.now = now.now;
|
|
72
|
+
exports.today = today.today;
|
|
73
|
+
exports.yesterday = yesterday.yesterday;
|
|
74
|
+
exports.tomorrow = tomorrow.tomorrow;
|
|
75
|
+
exports.toNative = toNative.toNative;
|
|
76
|
+
exports.InvalidTheDateError = toTimestamp.InvalidTheDateError;
|
|
77
|
+
exports.toTimestamp = toTimestamp.toTimestamp;
|
|
78
|
+
exports.toISOString = toISOString.toISOString;
|
|
79
|
+
exports.closestTo = closestTo.closestTo;
|
|
80
|
+
exports.each = each.each;
|
|
81
|
+
exports.CreateTheDateError = createOrThrow.CreateTheDateError;
|
|
82
|
+
exports.createOrThrow = createOrThrow.createOrThrow;
|
|
83
|
+
exports.round = round.round;
|
|
84
|
+
exports.isSafeTimestamp = isSafeTimestamp.isSafeTimestamp;
|
|
85
|
+
exports.timezone = timezone.timezone;
|
|
86
|
+
exports.getDayOfMonth = getDayOfMonth.getDayOfMonth;
|
|
87
|
+
exports.getDayOfWeek = getDayOfWeek.getDayOfWeek;
|
|
88
|
+
exports.getFirstDayOfWeek = getFirstDayOfWeek.getFirstDayOfWeek;
|
|
89
|
+
exports.getLastDayOfWeek = getLastDayOfWeek.getLastDayOfWeek;
|
|
90
|
+
exports.getFirstDayOfMonth = getFirstDayOfMonth.getFirstDayOfMonth;
|
|
91
|
+
exports.getLastDayOfMonth = getLastDayOfMonth.getLastDayOfMonth;
|
|
92
|
+
exports.getHour = getHour.getHour;
|
|
93
|
+
exports.getMilliseconds = getMilliseconds.getMilliseconds;
|
|
94
|
+
exports.getMinute = getMinute.getMinute;
|
|
95
|
+
exports.getMonth = getMonth.getMonth;
|
|
96
|
+
exports.getSecond = getSecond.getSecond;
|
|
97
|
+
exports.getYear = getYear.getYear;
|
|
98
|
+
exports.getDayOfYear = getDayOfYear.getDayOfYear;
|
|
99
|
+
exports.getWeekOfYear = getWeekOfYear.getWeekOfYear;
|
|
100
|
+
exports.addDays = addDays.addDays;
|
|
101
|
+
exports.addHours = addHours.addHours;
|
|
102
|
+
exports.addMilliseconds = addMilliseconds.addMilliseconds;
|
|
103
|
+
exports.addMinutes = addMinutes.addMinutes;
|
|
104
|
+
exports.addMonths = addMonths.addMonths;
|
|
105
|
+
exports.addSeconds = addSeconds.addSeconds;
|
|
106
|
+
exports.addWeeks = addWeeks.addWeeks;
|
|
107
|
+
exports.addYears = addYears.addYears;
|
|
108
|
+
exports.subtractDays = subtractDays.subtractDays;
|
|
109
|
+
exports.subtractHours = subtractHours.subtractHours;
|
|
110
|
+
exports.subtractMilliseconds = subtractMilliseconds.subtractMilliseconds;
|
|
111
|
+
exports.subtractMinutes = subtractMinutes.subtractMinutes;
|
|
112
|
+
exports.subtractMonths = subtractMonths.subtractMonths;
|
|
113
|
+
exports.subtractSeconds = subtractSeconds.subtractSeconds;
|
|
114
|
+
exports.subtractWeeks = subtractWeeks.subtractWeeks;
|
|
115
|
+
exports.subtractYears = subtractYears.subtractYears;
|
|
116
|
+
exports.between = between.between;
|
|
117
|
+
exports.betweenThan = betweenThan.betweenThan;
|
|
118
|
+
exports.greater = greater.greater;
|
|
119
|
+
exports.greaterThan = greaterThan.greaterThan;
|
|
120
|
+
exports.less = less.less;
|
|
121
|
+
exports.lessThan = lessThan.lessThan;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export * from "./constants";
|
|
3
|
+
export * from "./create";
|
|
4
|
+
export * from "./now";
|
|
5
|
+
export * from "./today";
|
|
6
|
+
export * from "./yesterday";
|
|
7
|
+
export * from "./tomorrow";
|
|
8
|
+
export * from "./toNative";
|
|
9
|
+
export * from "./toTimestamp";
|
|
10
|
+
export * from "./getters";
|
|
11
|
+
export * from "./toISOString";
|
|
12
|
+
export * from "./operators";
|
|
13
|
+
export * from "./closestTo";
|
|
14
|
+
export * from "./each";
|
|
15
|
+
export * from "./each";
|
|
16
|
+
export * from "./createOrThrow";
|
|
17
|
+
export * from "./round";
|
|
18
|
+
export * from "./isSafeTimestamp";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export { daysInOneWeek, hoursInOneDay, maxTimestamp, millisecondInOneHour, millisecondInOneMinute, millisecondInOneWeek, millisecondsInOneDay, millisecondsInOneSecond, minTimestamp, minutesInOneHour, monthtsInOneYear, secondsInOneMinute, theDateRegex } from './constants.mjs';
|
|
2
|
+
export { create } from './create.mjs';
|
|
3
|
+
export { now } from './now.mjs';
|
|
4
|
+
export { today } from './today.mjs';
|
|
5
|
+
export { yesterday } from './yesterday.mjs';
|
|
6
|
+
export { tomorrow } from './tomorrow.mjs';
|
|
7
|
+
export { toNative } from './toNative.mjs';
|
|
8
|
+
export { InvalidTheDateError, toTimestamp } from './toTimestamp.mjs';
|
|
9
|
+
export { toISOString } from './toISOString.mjs';
|
|
10
|
+
export { closestTo } from './closestTo.mjs';
|
|
11
|
+
export { each } from './each.mjs';
|
|
12
|
+
export { CreateTheDateError, createOrThrow } from './createOrThrow.mjs';
|
|
13
|
+
export { round } from './round.mjs';
|
|
14
|
+
export { isSafeTimestamp } from './isSafeTimestamp.mjs';
|
|
15
|
+
export { timezone } from './types/timezone.mjs';
|
|
16
|
+
export { getDayOfMonth } from './getters/getDayOfMonth.mjs';
|
|
17
|
+
export { getDayOfWeek } from './getters/getDayOfWeek.mjs';
|
|
18
|
+
export { getFirstDayOfWeek } from './getters/getFirstDayOfWeek.mjs';
|
|
19
|
+
export { getLastDayOfWeek } from './getters/getLastDayOfWeek.mjs';
|
|
20
|
+
export { getFirstDayOfMonth } from './getters/getFirstDayOfMonth.mjs';
|
|
21
|
+
export { getLastDayOfMonth } from './getters/getLastDayOfMonth.mjs';
|
|
22
|
+
export { getHour } from './getters/getHour.mjs';
|
|
23
|
+
export { getMilliseconds } from './getters/getMilliseconds.mjs';
|
|
24
|
+
export { getMinute } from './getters/getMinute.mjs';
|
|
25
|
+
export { getMonth } from './getters/getMonth.mjs';
|
|
26
|
+
export { getSecond } from './getters/getSecond.mjs';
|
|
27
|
+
export { getYear } from './getters/getYear.mjs';
|
|
28
|
+
export { getDayOfYear } from './getters/getDayOfYear.mjs';
|
|
29
|
+
export { getWeekOfYear } from './getters/getWeekOfYear.mjs';
|
|
30
|
+
export { addDays } from './operators/addDays.mjs';
|
|
31
|
+
export { addHours } from './operators/addHours.mjs';
|
|
32
|
+
export { addMilliseconds } from './operators/addMilliseconds.mjs';
|
|
33
|
+
export { addMinutes } from './operators/addMinutes.mjs';
|
|
34
|
+
export { addMonths } from './operators/addMonths.mjs';
|
|
35
|
+
export { addSeconds } from './operators/addSeconds.mjs';
|
|
36
|
+
export { addWeeks } from './operators/addWeeks.mjs';
|
|
37
|
+
export { addYears } from './operators/addYears.mjs';
|
|
38
|
+
export { subtractDays } from './operators/subtractDays.mjs';
|
|
39
|
+
export { subtractHours } from './operators/subtractHours.mjs';
|
|
40
|
+
export { subtractMilliseconds } from './operators/subtractMilliseconds.mjs';
|
|
41
|
+
export { subtractMinutes } from './operators/subtractMinutes.mjs';
|
|
42
|
+
export { subtractMonths } from './operators/subtractMonths.mjs';
|
|
43
|
+
export { subtractSeconds } from './operators/subtractSeconds.mjs';
|
|
44
|
+
export { subtractWeeks } from './operators/subtractWeeks.mjs';
|
|
45
|
+
export { subtractYears } from './operators/subtractYears.mjs';
|
|
46
|
+
export { between } from './operators/between.mjs';
|
|
47
|
+
export { betweenThan } from './operators/betweenThan.mjs';
|
|
48
|
+
export { greater } from './operators/greater.mjs';
|
|
49
|
+
export { greaterThan } from './operators/greaterThan.mjs';
|
|
50
|
+
export { less } from './operators/less.mjs';
|
|
51
|
+
export { lessThan } from './operators/lessThan.mjs';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constants = require('./constants.cjs');
|
|
4
|
+
|
|
5
|
+
function isSafeTimestamp(input) {
|
|
6
|
+
if (!Number.isSafeInteger(input)) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (input <= constants.minTimestamp || input >= constants.maxTimestamp) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.isSafeTimestamp = isSafeTimestamp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isSafeTimestamp(input: number): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { minTimestamp, maxTimestamp } from './constants.mjs';
|
|
2
|
+
|
|
3
|
+
function isSafeTimestamp(input) {
|
|
4
|
+
if (!Number.isSafeInteger(input)) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
if (input <= minTimestamp || input >= maxTimestamp) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { isSafeTimestamp };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function now(): `date${number}+`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var toNative = require('../toNative.cjs');
|
|
4
|
+
var constants = require('../constants.cjs');
|
|
5
|
+
|
|
6
|
+
function addDays(...args) {
|
|
7
|
+
if (args.length === 1) {
|
|
8
|
+
const [day] = args;
|
|
9
|
+
return (input) => addDays(input, day);
|
|
10
|
+
}
|
|
11
|
+
const [input, day] = args;
|
|
12
|
+
const absoluteDay = Math.abs(day);
|
|
13
|
+
const date = toNative.toNative(input);
|
|
14
|
+
date.setTime(date.getTime() + (absoluteDay * constants.millisecondsInOneDay));
|
|
15
|
+
const timestamp = date.getTime();
|
|
16
|
+
const isNegative = timestamp < 0;
|
|
17
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.addDays = addDays;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TheDate } from "../types";
|
|
2
|
+
import type { PositiveNumber } from "../../number/types";
|
|
3
|
+
export declare function addDays<GenericInput extends TheDate, GenericDay extends number>(day: PositiveNumber<GenericDay>): (input: GenericInput) => TheDate;
|
|
4
|
+
export declare function addDays<GenericInput extends TheDate, GenericDay extends number>(input: GenericInput, day: PositiveNumber<GenericDay>): TheDate;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { toNative } from '../toNative.mjs';
|
|
2
|
+
import { millisecondsInOneDay } from '../constants.mjs';
|
|
3
|
+
|
|
4
|
+
function addDays(...args) {
|
|
5
|
+
if (args.length === 1) {
|
|
6
|
+
const [day] = args;
|
|
7
|
+
return (input) => addDays(input, day);
|
|
8
|
+
}
|
|
9
|
+
const [input, day] = args;
|
|
10
|
+
const absoluteDay = Math.abs(day);
|
|
11
|
+
const date = toNative(input);
|
|
12
|
+
date.setTime(date.getTime() + (absoluteDay * millisecondsInOneDay));
|
|
13
|
+
const timestamp = date.getTime();
|
|
14
|
+
const isNegative = timestamp < 0;
|
|
15
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { addDays };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constants = require('../constants.cjs');
|
|
4
|
+
var toNative = require('../toNative.cjs');
|
|
5
|
+
|
|
6
|
+
function addHours(...args) {
|
|
7
|
+
if (args.length === 1) {
|
|
8
|
+
const [hour] = args;
|
|
9
|
+
return (input) => addHours(input, hour);
|
|
10
|
+
}
|
|
11
|
+
const [input, hour] = args;
|
|
12
|
+
const absoluteHour = Math.abs(hour);
|
|
13
|
+
const date = toNative.toNative(input);
|
|
14
|
+
date.setTime(date.getTime() + (absoluteHour * constants.millisecondInOneHour));
|
|
15
|
+
const timestamp = date.getTime();
|
|
16
|
+
const isNegative = timestamp < 0;
|
|
17
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.addHours = addHours;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TheDate } from "../types";
|
|
2
|
+
import type { PositiveNumber } from "../../number/types";
|
|
3
|
+
export declare function addHours<GenericInput extends TheDate, GenericHour extends number>(hour: PositiveNumber<GenericHour>): (input: GenericInput) => TheDate;
|
|
4
|
+
export declare function addHours<GenericInput extends TheDate, GenericHour extends number>(input: GenericInput, hour: PositiveNumber<GenericHour>): TheDate;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { millisecondInOneHour } from '../constants.mjs';
|
|
2
|
+
import { toNative } from '../toNative.mjs';
|
|
3
|
+
|
|
4
|
+
function addHours(...args) {
|
|
5
|
+
if (args.length === 1) {
|
|
6
|
+
const [hour] = args;
|
|
7
|
+
return (input) => addHours(input, hour);
|
|
8
|
+
}
|
|
9
|
+
const [input, hour] = args;
|
|
10
|
+
const absoluteHour = Math.abs(hour);
|
|
11
|
+
const date = toNative(input);
|
|
12
|
+
date.setTime(date.getTime() + (absoluteHour * millisecondInOneHour));
|
|
13
|
+
const timestamp = date.getTime();
|
|
14
|
+
const isNegative = timestamp < 0;
|
|
15
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { addHours };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var toNative = require('../toNative.cjs');
|
|
4
|
+
|
|
5
|
+
function addMilliseconds(...args) {
|
|
6
|
+
if (args.length === 1) {
|
|
7
|
+
const [millisecond] = args;
|
|
8
|
+
return (input) => addMilliseconds(input, millisecond);
|
|
9
|
+
}
|
|
10
|
+
const [input, millisecond] = args;
|
|
11
|
+
const absoluteMilliseconds = Math.abs(millisecond);
|
|
12
|
+
const date = toNative.toNative(input);
|
|
13
|
+
date.setTime(date.getTime() + absoluteMilliseconds);
|
|
14
|
+
const timestamp = date.getTime();
|
|
15
|
+
const isNegative = timestamp < 0;
|
|
16
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.addMilliseconds = addMilliseconds;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TheDate } from "../types";
|
|
2
|
+
import type { PositiveNumber } from "../../number/types";
|
|
3
|
+
export declare function addMilliseconds<GenericInput extends TheDate, GenericMillisecond extends number>(millisecond: PositiveNumber<GenericMillisecond>): (input: GenericInput) => TheDate;
|
|
4
|
+
export declare function addMilliseconds<GenericInput extends TheDate, GenericMillisecond extends number>(input: GenericInput, millisecond: PositiveNumber<GenericMillisecond>): TheDate;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { toNative } from '../toNative.mjs';
|
|
2
|
+
|
|
3
|
+
function addMilliseconds(...args) {
|
|
4
|
+
if (args.length === 1) {
|
|
5
|
+
const [millisecond] = args;
|
|
6
|
+
return (input) => addMilliseconds(input, millisecond);
|
|
7
|
+
}
|
|
8
|
+
const [input, millisecond] = args;
|
|
9
|
+
const absoluteMilliseconds = Math.abs(millisecond);
|
|
10
|
+
const date = toNative(input);
|
|
11
|
+
date.setTime(date.getTime() + absoluteMilliseconds);
|
|
12
|
+
const timestamp = date.getTime();
|
|
13
|
+
const isNegative = timestamp < 0;
|
|
14
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { addMilliseconds };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constants = require('../constants.cjs');
|
|
4
|
+
var toNative = require('../toNative.cjs');
|
|
5
|
+
|
|
6
|
+
function addMinutes(...args) {
|
|
7
|
+
if (args.length === 1) {
|
|
8
|
+
const [minute] = args;
|
|
9
|
+
return (input) => addMinutes(input, minute);
|
|
10
|
+
}
|
|
11
|
+
const [input, minute] = args;
|
|
12
|
+
const absoluteMinute = Math.abs(minute);
|
|
13
|
+
const date = toNative.toNative(input);
|
|
14
|
+
date.setTime(date.getTime() + (absoluteMinute * constants.millisecondInOneMinute));
|
|
15
|
+
const timestamp = date.getTime();
|
|
16
|
+
const isNegative = timestamp < 0;
|
|
17
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.addMinutes = addMinutes;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TheDate } from "../types";
|
|
2
|
+
import type { PositiveNumber } from "../../number/types";
|
|
3
|
+
export declare function addMinutes<GenericInput extends TheDate, GenericMinute extends number>(minute: PositiveNumber<GenericMinute>): (input: GenericInput) => TheDate;
|
|
4
|
+
export declare function addMinutes<GenericInput extends TheDate, GenericMinute extends number>(input: GenericInput, minute: PositiveNumber<GenericMinute>): TheDate;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { millisecondInOneMinute } from '../constants.mjs';
|
|
2
|
+
import { toNative } from '../toNative.mjs';
|
|
3
|
+
|
|
4
|
+
function addMinutes(...args) {
|
|
5
|
+
if (args.length === 1) {
|
|
6
|
+
const [minute] = args;
|
|
7
|
+
return (input) => addMinutes(input, minute);
|
|
8
|
+
}
|
|
9
|
+
const [input, minute] = args;
|
|
10
|
+
const absoluteMinute = Math.abs(minute);
|
|
11
|
+
const date = toNative(input);
|
|
12
|
+
date.setTime(date.getTime() + (absoluteMinute * millisecondInOneMinute));
|
|
13
|
+
const timestamp = date.getTime();
|
|
14
|
+
const isNegative = timestamp < 0;
|
|
15
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { addMinutes };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var toNative = require('../toNative.cjs');
|
|
4
|
+
|
|
5
|
+
function addMonths(...args) {
|
|
6
|
+
if (args.length === 1) {
|
|
7
|
+
const [month] = args;
|
|
8
|
+
return (input) => addMonths(input, month);
|
|
9
|
+
}
|
|
10
|
+
const [input, month] = args;
|
|
11
|
+
const absoluteMonth = Math.abs(month);
|
|
12
|
+
const date = toNative.toNative(input);
|
|
13
|
+
date.setUTCMonth(date.getUTCMonth() + absoluteMonth);
|
|
14
|
+
const timestamp = date.getTime();
|
|
15
|
+
const isNegative = timestamp < 0;
|
|
16
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.addMonths = addMonths;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TheDate } from "../types";
|
|
2
|
+
import type { PositiveNumber } from "../../number/types";
|
|
3
|
+
export declare function addMonths<GenericInput extends TheDate, GenericMonth extends number>(month: PositiveNumber<GenericMonth>): (input: GenericInput) => TheDate;
|
|
4
|
+
export declare function addMonths<GenericInput extends TheDate, GenericMonth extends number>(input: GenericInput, month: PositiveNumber<GenericMonth>): TheDate;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { toNative } from '../toNative.mjs';
|
|
2
|
+
|
|
3
|
+
function addMonths(...args) {
|
|
4
|
+
if (args.length === 1) {
|
|
5
|
+
const [month] = args;
|
|
6
|
+
return (input) => addMonths(input, month);
|
|
7
|
+
}
|
|
8
|
+
const [input, month] = args;
|
|
9
|
+
const absoluteMonth = Math.abs(month);
|
|
10
|
+
const date = toNative(input);
|
|
11
|
+
date.setUTCMonth(date.getUTCMonth() + absoluteMonth);
|
|
12
|
+
const timestamp = date.getTime();
|
|
13
|
+
const isNegative = timestamp < 0;
|
|
14
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { addMonths };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constants = require('../constants.cjs');
|
|
4
|
+
var toNative = require('../toNative.cjs');
|
|
5
|
+
|
|
6
|
+
function addSeconds(...args) {
|
|
7
|
+
if (args.length === 1) {
|
|
8
|
+
const [second] = args;
|
|
9
|
+
return (input) => addSeconds(input, second);
|
|
10
|
+
}
|
|
11
|
+
const [input, second] = args;
|
|
12
|
+
const absoluteSecond = Math.abs(second);
|
|
13
|
+
const date = toNative.toNative(input);
|
|
14
|
+
date.setTime(date.getTime() + (absoluteSecond * constants.millisecondsInOneSecond));
|
|
15
|
+
const timestamp = date.getTime();
|
|
16
|
+
const isNegative = timestamp < 0;
|
|
17
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.addSeconds = addSeconds;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TheDate } from "../types";
|
|
2
|
+
import type { PositiveNumber } from "../../number/types";
|
|
3
|
+
export declare function addSeconds<GenericInput extends TheDate, GenericSecond extends number>(second: PositiveNumber<GenericSecond>): (input: GenericInput) => TheDate;
|
|
4
|
+
export declare function addSeconds<GenericInput extends TheDate, GenericSecond extends number>(input: GenericInput, second: PositiveNumber<GenericSecond>): TheDate;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { millisecondsInOneSecond } from '../constants.mjs';
|
|
2
|
+
import { toNative } from '../toNative.mjs';
|
|
3
|
+
|
|
4
|
+
function addSeconds(...args) {
|
|
5
|
+
if (args.length === 1) {
|
|
6
|
+
const [second] = args;
|
|
7
|
+
return (input) => addSeconds(input, second);
|
|
8
|
+
}
|
|
9
|
+
const [input, second] = args;
|
|
10
|
+
const absoluteSecond = Math.abs(second);
|
|
11
|
+
const date = toNative(input);
|
|
12
|
+
date.setTime(date.getTime() + (absoluteSecond * millisecondsInOneSecond));
|
|
13
|
+
const timestamp = date.getTime();
|
|
14
|
+
const isNegative = timestamp < 0;
|
|
15
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { addSeconds };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constants = require('../constants.cjs');
|
|
4
|
+
var toNative = require('../toNative.cjs');
|
|
5
|
+
|
|
6
|
+
function addWeeks(...args) {
|
|
7
|
+
if (args.length === 1) {
|
|
8
|
+
const [week] = args;
|
|
9
|
+
return (input) => addWeeks(input, week);
|
|
10
|
+
}
|
|
11
|
+
const [input, week] = args;
|
|
12
|
+
const absoluteWeek = Math.abs(week);
|
|
13
|
+
const date = toNative.toNative(input);
|
|
14
|
+
date.setTime(date.getTime() + (absoluteWeek * constants.millisecondInOneWeek));
|
|
15
|
+
const timestamp = date.getTime();
|
|
16
|
+
const isNegative = timestamp < 0;
|
|
17
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.addWeeks = addWeeks;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TheDate } from "../types";
|
|
2
|
+
import type { PositiveNumber } from "../../number/types";
|
|
3
|
+
export declare function addWeeks<GenericInput extends TheDate, GenericWeek extends number>(week: PositiveNumber<GenericWeek>): (input: GenericInput) => TheDate;
|
|
4
|
+
export declare function addWeeks<GenericInput extends TheDate, GenericWeek extends number>(input: GenericInput, week: PositiveNumber<GenericWeek>): TheDate;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { millisecondInOneWeek } from '../constants.mjs';
|
|
2
|
+
import { toNative } from '../toNative.mjs';
|
|
3
|
+
|
|
4
|
+
function addWeeks(...args) {
|
|
5
|
+
if (args.length === 1) {
|
|
6
|
+
const [week] = args;
|
|
7
|
+
return (input) => addWeeks(input, week);
|
|
8
|
+
}
|
|
9
|
+
const [input, week] = args;
|
|
10
|
+
const absoluteWeek = Math.abs(week);
|
|
11
|
+
const date = toNative(input);
|
|
12
|
+
date.setTime(date.getTime() + (absoluteWeek * millisecondInOneWeek));
|
|
13
|
+
const timestamp = date.getTime();
|
|
14
|
+
const isNegative = timestamp < 0;
|
|
15
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { addWeeks };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var toNative = require('../toNative.cjs');
|
|
4
|
+
|
|
5
|
+
function addYears(...args) {
|
|
6
|
+
if (args.length === 1) {
|
|
7
|
+
const [year] = args;
|
|
8
|
+
return (input) => addYears(input, year);
|
|
9
|
+
}
|
|
10
|
+
const [input, year] = args;
|
|
11
|
+
const absoluteYear = Math.abs(year);
|
|
12
|
+
const date = toNative.toNative(input);
|
|
13
|
+
date.setUTCFullYear(date.getUTCFullYear() + absoluteYear);
|
|
14
|
+
const timestamp = date.getTime();
|
|
15
|
+
const isNegative = timestamp < 0;
|
|
16
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.addYears = addYears;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TheDate } from "../types";
|
|
2
|
+
import type { PositiveNumber } from "../../number/types";
|
|
3
|
+
export declare function addYears<GenericInput extends TheDate, GenericYear extends number>(year: PositiveNumber<GenericYear>): (input: GenericInput) => TheDate;
|
|
4
|
+
export declare function addYears<GenericInput extends TheDate, GenericYear extends number>(input: GenericInput, year: PositiveNumber<GenericYear>): TheDate;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { toNative } from '../toNative.mjs';
|
|
2
|
+
|
|
3
|
+
function addYears(...args) {
|
|
4
|
+
if (args.length === 1) {
|
|
5
|
+
const [year] = args;
|
|
6
|
+
return (input) => addYears(input, year);
|
|
7
|
+
}
|
|
8
|
+
const [input, year] = args;
|
|
9
|
+
const absoluteYear = Math.abs(year);
|
|
10
|
+
const date = toNative(input);
|
|
11
|
+
date.setUTCFullYear(date.getUTCFullYear() + absoluteYear);
|
|
12
|
+
const timestamp = date.getTime();
|
|
13
|
+
const isNegative = timestamp < 0;
|
|
14
|
+
return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { addYears };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var toTimestamp = require('../toTimestamp.cjs');
|
|
4
|
+
|
|
5
|
+
function between(...args) {
|
|
6
|
+
if (args.length === 2) {
|
|
7
|
+
const [greater, less] = args;
|
|
8
|
+
return (input) => between(input, greater, less);
|
|
9
|
+
}
|
|
10
|
+
const [input, greater, less] = args;
|
|
11
|
+
const inputTimestamp = toTimestamp.toTimestamp(input);
|
|
12
|
+
const greaterTimestamp = toTimestamp.toTimestamp(greater);
|
|
13
|
+
const lessTimestamp = toTimestamp.toTimestamp(less);
|
|
14
|
+
return inputTimestamp >= greaterTimestamp && inputTimestamp <= lessTimestamp;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
exports.between = between;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { TheDate } from "../types";
|
|
2
|
+
export declare function between<GenericValue extends TheDate>(greater: TheDate, less: TheDate): (input: GenericValue) => boolean;
|
|
3
|
+
export declare function between<GenericValue extends TheDate>(input: GenericValue, greater: TheDate, less: TheDate): boolean;
|