@kdtlabs/utils 0.0.4 → 0.0.5
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/SKILL.md +7 -9
- package/{common → dist/common}/assertions.d.ts +1 -1
- package/{common → dist/common}/assertions.d.ts.map +1 -1
- package/{common → dist/common}/types.d.ts +1 -1
- package/{common → dist/common}/types.d.ts.map +1 -1
- package/{functions → dist/functions}/executions.d.ts +1 -1
- package/{functions → dist/functions}/executions.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +99 -0
- package/{objects → dist/objects}/transformations.d.ts +1 -1
- package/{objects → dist/objects}/transformations.d.ts.map +1 -1
- package/{objects → dist/objects}/types.d.ts +1 -1
- package/{objects → dist/objects}/types.d.ts.map +1 -1
- package/{promises → dist/promises}/deferred.d.ts +1 -1
- package/{promises → dist/promises}/deferred.d.ts.map +1 -1
- package/{promises → dist/promises}/timers.d.ts +1 -1
- package/{promises → dist/promises}/timers.d.ts.map +1 -1
- package/{serializer → dist/serializer}/context.d.ts +1 -1
- package/{serializer → dist/serializer}/context.d.ts.map +1 -1
- package/{serializer → dist/serializer}/serialize.d.ts +1 -1
- package/{serializer → dist/serializer}/serialize.d.ts.map +1 -1
- package/{serializer → dist/serializer}/serializers/array.d.ts +1 -1
- package/{serializer → dist/serializer}/serializers/array.d.ts.map +1 -1
- package/{serializer → dist/serializer}/serializers/binary.d.ts +1 -1
- package/dist/serializer/serializers/binary.d.ts.map +1 -0
- package/{serializer → dist/serializer}/serializers/blob.d.ts +1 -1
- package/dist/serializer/serializers/blob.d.ts.map +1 -0
- package/{serializer → dist/serializer}/serializers/collection.d.ts +1 -1
- package/{serializer → dist/serializer}/serializers/collection.d.ts.map +1 -1
- package/{serializer → dist/serializer}/serializers/compound.d.ts +1 -1
- package/{serializer → dist/serializer}/serializers/compound.d.ts.map +1 -1
- package/{serializer → dist/serializer}/serializers/error.d.ts +1 -1
- package/{serializer → dist/serializer}/serializers/error.d.ts.map +1 -1
- package/{serializer → dist/serializer}/serializers/function.d.ts +1 -1
- package/{serializer → dist/serializer}/serializers/function.d.ts.map +1 -1
- package/{serializer → dist/serializer}/serializers/leaf-object.d.ts +1 -1
- package/{serializer → dist/serializer}/serializers/leaf-object.d.ts.map +1 -1
- package/{serializer → dist/serializer}/serializers/number.d.ts +1 -1
- package/dist/serializer/serializers/number.d.ts.map +1 -0
- package/{serializer → dist/serializer}/serializers/object.d.ts +1 -1
- package/{serializer → dist/serializer}/serializers/object.d.ts.map +1 -1
- package/{serializer → dist/serializer}/serializers/opaque.d.ts +1 -1
- package/dist/serializer/serializers/opaque.d.ts.map +1 -0
- package/{serializer → dist/serializer}/serializers/primitive.d.ts +1 -1
- package/{serializer → dist/serializer}/serializers/primitive.d.ts.map +1 -1
- package/{serializer → dist/serializer}/types.d.ts +1 -1
- package/{serializer → dist/serializer}/types.d.ts.map +1 -1
- package/{serializer → dist/serializer}/utils.d.ts +1 -1
- package/{serializer → dist/serializer}/utils.d.ts.map +1 -1
- package/{system → dist/system}/fetch.d.ts +2 -2
- package/{system → dist/system}/fetch.d.ts.map +1 -1
- package/dist/system/types.d.ts +3 -0
- package/{system → dist/system}/types.d.ts.map +1 -1
- package/{times → dist/times}/conversions.d.ts +1 -1
- package/{times → dist/times}/conversions.d.ts.map +1 -1
- package/package.json +11 -73
- package/src/arrays/accessors.ts +25 -0
- package/src/arrays/conversions.ts +16 -0
- package/src/arrays/factories.ts +13 -0
- package/src/arrays/guards.ts +7 -0
- package/src/arrays/index.ts +8 -0
- package/src/arrays/operations.ts +103 -0
- package/src/arrays/set-operations.ts +11 -0
- package/src/arrays/types.ts +21 -0
- package/src/buffers/conversions.ts +26 -0
- package/src/buffers/guards.ts +13 -0
- package/src/buffers/index.ts +5 -0
- package/src/buffers/operations.ts +44 -0
- package/src/buffers/types.ts +1 -0
- package/src/collections/fifo-map.ts +33 -0
- package/src/collections/fifo-set.ts +29 -0
- package/src/collections/guards.ts +11 -0
- package/src/collections/index.ts +10 -0
- package/src/collections/linked-base.ts +117 -0
- package/src/collections/linked-map.ts +82 -0
- package/src/collections/linked-set.ts +69 -0
- package/src/collections/lru-map.ts +36 -0
- package/src/collections/lru-set.ts +25 -0
- package/src/collections/types.ts +12 -0
- package/src/common/assertions.ts +11 -0
- package/src/common/guards.ts +58 -0
- package/src/common/index.ts +5 -0
- package/src/common/transformations.ts +20 -0
- package/src/common/types.ts +3 -0
- package/src/core/constants.ts +1 -0
- package/src/core/conversions.ts +9 -0
- package/src/core/guards.ts +57 -0
- package/src/core/index.ts +5 -0
- package/src/core/types.ts +15 -0
- package/src/errors/base-error.ts +48 -0
- package/src/errors/factories.ts +74 -0
- package/src/errors/guards.ts +12 -0
- package/src/errors/index.ts +7 -0
- package/src/errors/operations.ts +15 -0
- package/src/errors/stringify.ts +131 -0
- package/src/errors/types.ts +11 -0
- package/src/events/emitter.ts +117 -0
- package/src/events/index.ts +2 -0
- package/src/events/types.ts +11 -0
- package/src/functions/compositions.ts +17 -0
- package/src/functions/debounce.ts +34 -0
- package/src/functions/executions.ts +12 -0
- package/src/functions/guards.ts +5 -0
- package/src/functions/index.ts +11 -0
- package/src/functions/memoize.ts +33 -0
- package/src/functions/once.ts +33 -0
- package/src/functions/pipe.ts +39 -0
- package/src/functions/throttle.ts +59 -0
- package/src/functions/timer-state.ts +33 -0
- package/src/functions/types.ts +8 -0
- package/src/index.ts +16 -0
- package/src/json-rpc/constants.ts +15 -0
- package/src/json-rpc/factories.ts +22 -0
- package/src/json-rpc/guards.ts +58 -0
- package/src/json-rpc/index.ts +5 -0
- package/src/json-rpc/types.ts +48 -0
- package/src/numbers/bigint-math.ts +163 -0
- package/src/numbers/constants.ts +14 -0
- package/src/numbers/conversions.ts +83 -0
- package/src/numbers/factories.ts +6 -0
- package/src/numbers/formats.ts +52 -0
- package/src/numbers/guards.ts +22 -0
- package/src/numbers/index.ts +10 -0
- package/src/numbers/maths.ts +28 -0
- package/src/numbers/ranges.ts +17 -0
- package/src/numbers/types.ts +7 -0
- package/src/objects/deep-merge.ts +76 -0
- package/src/objects/guards.ts +21 -0
- package/src/objects/index.ts +5 -0
- package/src/objects/transformations.ts +34 -0
- package/src/objects/types.ts +33 -0
- package/src/promises/abortable.ts +37 -0
- package/src/promises/compositions.ts +18 -0
- package/src/promises/deferred.ts +131 -0
- package/src/promises/guards.ts +8 -0
- package/src/promises/index.ts +10 -0
- package/src/promises/pipe.ts +39 -0
- package/src/promises/poll.ts +92 -0
- package/src/promises/retry.ts +138 -0
- package/src/promises/timers.ts +16 -0
- package/src/promises/types.ts +1 -0
- package/src/serializer/constants.ts +5 -0
- package/src/serializer/context.ts +24 -0
- package/src/serializer/index.ts +8 -0
- package/src/serializer/serialize.ts +51 -0
- package/src/serializer/serializers/array.ts +17 -0
- package/src/serializer/serializers/binary.ts +24 -0
- package/src/serializer/serializers/blob.ts +18 -0
- package/src/serializer/serializers/collection.ts +25 -0
- package/src/serializer/serializers/compound.ts +79 -0
- package/src/serializer/serializers/error.ts +75 -0
- package/src/serializer/serializers/function.ts +13 -0
- package/src/serializer/serializers/index.ts +12 -0
- package/src/serializer/serializers/leaf-object.ts +18 -0
- package/src/serializer/serializers/number.ts +14 -0
- package/src/serializer/serializers/object.ts +62 -0
- package/src/serializer/serializers/opaque.ts +36 -0
- package/src/serializer/serializers/primitive.ts +32 -0
- package/src/serializer/symbol-registry.ts +28 -0
- package/src/serializer/types.ts +42 -0
- package/src/serializer/utils.ts +15 -0
- package/src/strings/constants.ts +1 -0
- package/src/strings/factories.ts +9 -0
- package/src/strings/guards.ts +51 -0
- package/src/strings/index.ts +6 -0
- package/src/strings/manipulations.ts +99 -0
- package/src/strings/types.ts +3 -0
- package/src/system/env.ts +32 -0
- package/src/system/fetch.ts +23 -0
- package/src/system/graceful-exit.ts +46 -0
- package/src/system/index.ts +6 -0
- package/src/system/path.ts +12 -0
- package/src/system/types.ts +3 -0
- package/src/times/constants.ts +6 -0
- package/src/times/conversions.ts +85 -0
- package/src/times/factories.ts +3 -0
- package/src/times/guards.ts +3 -0
- package/src/times/index.ts +5 -0
- package/src/times/operations.ts +9 -0
- package/CHANGELOG.md +0 -57
- package/arrays/index.js +0 -4
- package/arrays/index.js.map +0 -9
- package/buffers/index.js +0 -4
- package/buffers/index.js.map +0 -9
- package/chunk-25ja9350.js +0 -4
- package/chunk-25ja9350.js.map +0 -13
- package/chunk-3w6nt7kb.js +0 -4
- package/chunk-3w6nt7kb.js.map +0 -12
- package/chunk-5txwcr6j.js +0 -4
- package/chunk-5txwcr6j.js.map +0 -17
- package/chunk-6dxad51h.js +0 -4
- package/chunk-6dxad51h.js.map +0 -12
- package/chunk-6kdnnxe0.js +0 -4
- package/chunk-6kdnnxe0.js.map +0 -17
- package/chunk-7cndek91.js +0 -4
- package/chunk-7cndek91.js.map +0 -15
- package/chunk-bee0nxse.js +0 -6
- package/chunk-bee0nxse.js.map +0 -14
- package/chunk-bjmntg2y.js +0 -4
- package/chunk-bjmntg2y.js.map +0 -18
- package/chunk-d0d0d285.js +0 -4
- package/chunk-d0d0d285.js.map +0 -26
- package/chunk-jny2gdyy.js +0 -4
- package/chunk-jny2gdyy.js.map +0 -12
- package/chunk-kbzgn0z4.js +0 -4
- package/chunk-kbzgn0z4.js.map +0 -10
- package/chunk-qmbgp0vr.js +0 -4
- package/chunk-qmbgp0vr.js.map +0 -12
- package/chunk-qn6n0ff5.js +0 -4
- package/chunk-qn6n0ff5.js.map +0 -17
- package/chunk-r3maskdb.js +0 -5
- package/chunk-r3maskdb.js.map +0 -13
- package/chunk-st3dxvqt.js +0 -4
- package/chunk-st3dxvqt.js.map +0 -14
- package/chunk-xp18wdk6.js +0 -4
- package/chunk-xp18wdk6.js.map +0 -12
- package/collections/index.js +0 -4
- package/collections/index.js.map +0 -9
- package/common/index.js +0 -4
- package/common/index.js.map +0 -9
- package/core/index.js +0 -4
- package/core/index.js.map +0 -9
- package/errors/index.js +0 -4
- package/errors/index.js.map +0 -9
- package/events/index.js +0 -4
- package/events/index.js.map +0 -9
- package/functions/index.js +0 -4
- package/functions/index.js.map +0 -9
- package/index.js +0 -4
- package/index.js.map +0 -9
- package/json-rpc/index.js +0 -4
- package/json-rpc/index.js.map +0 -9
- package/meta.json +0 -2998
- package/meta.md +0 -1816
- package/numbers/index.js +0 -4
- package/numbers/index.js.map +0 -9
- package/objects/index.js +0 -4
- package/objects/index.js.map +0 -9
- package/promises/index.js +0 -4
- package/promises/index.js.map +0 -9
- package/serializer/index.js +0 -4
- package/serializer/index.js.map +0 -9
- package/serializer/serializers/binary.d.ts.map +0 -1
- package/serializer/serializers/blob.d.ts.map +0 -1
- package/serializer/serializers/number.d.ts.map +0 -1
- package/serializer/serializers/opaque.d.ts.map +0 -1
- package/strings/index.js +0 -4
- package/strings/index.js.map +0 -9
- package/system/index.js +0 -4
- package/system/index.js.map +0 -9
- package/system/types.d.ts +0 -3
- package/times/index.js +0 -4
- package/times/index.js.map +0 -9
- /package/{arrays → dist/arrays}/accessors.d.ts +0 -0
- /package/{arrays → dist/arrays}/accessors.d.ts.map +0 -0
- /package/{arrays → dist/arrays}/conversions.d.ts +0 -0
- /package/{arrays → dist/arrays}/conversions.d.ts.map +0 -0
- /package/{arrays → dist/arrays}/factories.d.ts +0 -0
- /package/{arrays → dist/arrays}/factories.d.ts.map +0 -0
- /package/{arrays → dist/arrays}/guards.d.ts +0 -0
- /package/{arrays → dist/arrays}/guards.d.ts.map +0 -0
- /package/{arrays → dist/arrays}/index.d.ts +0 -0
- /package/{arrays → dist/arrays}/index.d.ts.map +0 -0
- /package/{arrays → dist/arrays}/operations.d.ts +0 -0
- /package/{arrays → dist/arrays}/operations.d.ts.map +0 -0
- /package/{arrays → dist/arrays}/set-operations.d.ts +0 -0
- /package/{arrays → dist/arrays}/set-operations.d.ts.map +0 -0
- /package/{arrays → dist/arrays}/types.d.ts +0 -0
- /package/{arrays → dist/arrays}/types.d.ts.map +0 -0
- /package/{buffers → dist/buffers}/conversions.d.ts +0 -0
- /package/{buffers → dist/buffers}/conversions.d.ts.map +0 -0
- /package/{buffers → dist/buffers}/guards.d.ts +0 -0
- /package/{buffers → dist/buffers}/guards.d.ts.map +0 -0
- /package/{buffers → dist/buffers}/index.d.ts +0 -0
- /package/{buffers → dist/buffers}/index.d.ts.map +0 -0
- /package/{buffers → dist/buffers}/operations.d.ts +0 -0
- /package/{buffers → dist/buffers}/operations.d.ts.map +0 -0
- /package/{buffers → dist/buffers}/types.d.ts +0 -0
- /package/{buffers → dist/buffers}/types.d.ts.map +0 -0
- /package/{collections → dist/collections}/fifo-map.d.ts +0 -0
- /package/{collections → dist/collections}/fifo-map.d.ts.map +0 -0
- /package/{collections → dist/collections}/fifo-set.d.ts +0 -0
- /package/{collections → dist/collections}/fifo-set.d.ts.map +0 -0
- /package/{collections → dist/collections}/guards.d.ts +0 -0
- /package/{collections → dist/collections}/guards.d.ts.map +0 -0
- /package/{collections → dist/collections}/index.d.ts +0 -0
- /package/{collections → dist/collections}/index.d.ts.map +0 -0
- /package/{collections → dist/collections}/linked-base.d.ts +0 -0
- /package/{collections → dist/collections}/linked-base.d.ts.map +0 -0
- /package/{collections → dist/collections}/linked-map.d.ts +0 -0
- /package/{collections → dist/collections}/linked-map.d.ts.map +0 -0
- /package/{collections → dist/collections}/linked-set.d.ts +0 -0
- /package/{collections → dist/collections}/linked-set.d.ts.map +0 -0
- /package/{collections → dist/collections}/lru-map.d.ts +0 -0
- /package/{collections → dist/collections}/lru-map.d.ts.map +0 -0
- /package/{collections → dist/collections}/lru-set.d.ts +0 -0
- /package/{collections → dist/collections}/lru-set.d.ts.map +0 -0
- /package/{collections → dist/collections}/types.d.ts +0 -0
- /package/{collections → dist/collections}/types.d.ts.map +0 -0
- /package/{common → dist/common}/guards.d.ts +0 -0
- /package/{common → dist/common}/guards.d.ts.map +0 -0
- /package/{common → dist/common}/index.d.ts +0 -0
- /package/{common → dist/common}/index.d.ts.map +0 -0
- /package/{common → dist/common}/transformations.d.ts +0 -0
- /package/{common → dist/common}/transformations.d.ts.map +0 -0
- /package/{core → dist/core}/constants.d.ts +0 -0
- /package/{core → dist/core}/constants.d.ts.map +0 -0
- /package/{core → dist/core}/conversions.d.ts +0 -0
- /package/{core → dist/core}/conversions.d.ts.map +0 -0
- /package/{core → dist/core}/guards.d.ts +0 -0
- /package/{core → dist/core}/guards.d.ts.map +0 -0
- /package/{core → dist/core}/index.d.ts +0 -0
- /package/{core → dist/core}/index.d.ts.map +0 -0
- /package/{core → dist/core}/types.d.ts +0 -0
- /package/{core → dist/core}/types.d.ts.map +0 -0
- /package/{errors → dist/errors}/base-error.d.ts +0 -0
- /package/{errors → dist/errors}/base-error.d.ts.map +0 -0
- /package/{errors → dist/errors}/factories.d.ts +0 -0
- /package/{errors → dist/errors}/factories.d.ts.map +0 -0
- /package/{errors → dist/errors}/guards.d.ts +0 -0
- /package/{errors → dist/errors}/guards.d.ts.map +0 -0
- /package/{errors → dist/errors}/index.d.ts +0 -0
- /package/{errors → dist/errors}/index.d.ts.map +0 -0
- /package/{errors → dist/errors}/operations.d.ts +0 -0
- /package/{errors → dist/errors}/operations.d.ts.map +0 -0
- /package/{errors → dist/errors}/stringify.d.ts +0 -0
- /package/{errors → dist/errors}/stringify.d.ts.map +0 -0
- /package/{errors → dist/errors}/types.d.ts +0 -0
- /package/{errors → dist/errors}/types.d.ts.map +0 -0
- /package/{events → dist/events}/emitter.d.ts +0 -0
- /package/{events → dist/events}/emitter.d.ts.map +0 -0
- /package/{events → dist/events}/index.d.ts +0 -0
- /package/{events → dist/events}/index.d.ts.map +0 -0
- /package/{events → dist/events}/types.d.ts +0 -0
- /package/{events → dist/events}/types.d.ts.map +0 -0
- /package/{functions → dist/functions}/compositions.d.ts +0 -0
- /package/{functions → dist/functions}/compositions.d.ts.map +0 -0
- /package/{functions → dist/functions}/debounce.d.ts +0 -0
- /package/{functions → dist/functions}/debounce.d.ts.map +0 -0
- /package/{functions → dist/functions}/guards.d.ts +0 -0
- /package/{functions → dist/functions}/guards.d.ts.map +0 -0
- /package/{functions → dist/functions}/index.d.ts +0 -0
- /package/{functions → dist/functions}/index.d.ts.map +0 -0
- /package/{functions → dist/functions}/memoize.d.ts +0 -0
- /package/{functions → dist/functions}/memoize.d.ts.map +0 -0
- /package/{functions → dist/functions}/once.d.ts +0 -0
- /package/{functions → dist/functions}/once.d.ts.map +0 -0
- /package/{functions → dist/functions}/pipe.d.ts +0 -0
- /package/{functions → dist/functions}/pipe.d.ts.map +0 -0
- /package/{functions → dist/functions}/throttle.d.ts +0 -0
- /package/{functions → dist/functions}/throttle.d.ts.map +0 -0
- /package/{functions → dist/functions}/timer-state.d.ts +0 -0
- /package/{functions → dist/functions}/timer-state.d.ts.map +0 -0
- /package/{functions → dist/functions}/types.d.ts +0 -0
- /package/{functions → dist/functions}/types.d.ts.map +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{index.d.ts.map → dist/index.d.ts.map} +0 -0
- /package/{json-rpc → dist/json-rpc}/constants.d.ts +0 -0
- /package/{json-rpc → dist/json-rpc}/constants.d.ts.map +0 -0
- /package/{json-rpc → dist/json-rpc}/factories.d.ts +0 -0
- /package/{json-rpc → dist/json-rpc}/factories.d.ts.map +0 -0
- /package/{json-rpc → dist/json-rpc}/guards.d.ts +0 -0
- /package/{json-rpc → dist/json-rpc}/guards.d.ts.map +0 -0
- /package/{json-rpc → dist/json-rpc}/index.d.ts +0 -0
- /package/{json-rpc → dist/json-rpc}/index.d.ts.map +0 -0
- /package/{json-rpc → dist/json-rpc}/types.d.ts +0 -0
- /package/{json-rpc → dist/json-rpc}/types.d.ts.map +0 -0
- /package/{numbers → dist/numbers}/bigint-math.d.ts +0 -0
- /package/{numbers → dist/numbers}/bigint-math.d.ts.map +0 -0
- /package/{numbers → dist/numbers}/constants.d.ts +0 -0
- /package/{numbers → dist/numbers}/constants.d.ts.map +0 -0
- /package/{numbers → dist/numbers}/conversions.d.ts +0 -0
- /package/{numbers → dist/numbers}/conversions.d.ts.map +0 -0
- /package/{numbers → dist/numbers}/factories.d.ts +0 -0
- /package/{numbers → dist/numbers}/factories.d.ts.map +0 -0
- /package/{numbers → dist/numbers}/formats.d.ts +0 -0
- /package/{numbers → dist/numbers}/formats.d.ts.map +0 -0
- /package/{numbers → dist/numbers}/guards.d.ts +0 -0
- /package/{numbers → dist/numbers}/guards.d.ts.map +0 -0
- /package/{numbers → dist/numbers}/index.d.ts +0 -0
- /package/{numbers → dist/numbers}/index.d.ts.map +0 -0
- /package/{numbers → dist/numbers}/maths.d.ts +0 -0
- /package/{numbers → dist/numbers}/maths.d.ts.map +0 -0
- /package/{numbers → dist/numbers}/ranges.d.ts +0 -0
- /package/{numbers → dist/numbers}/ranges.d.ts.map +0 -0
- /package/{numbers → dist/numbers}/types.d.ts +0 -0
- /package/{numbers → dist/numbers}/types.d.ts.map +0 -0
- /package/{objects → dist/objects}/deep-merge.d.ts +0 -0
- /package/{objects → dist/objects}/deep-merge.d.ts.map +0 -0
- /package/{objects → dist/objects}/guards.d.ts +0 -0
- /package/{objects → dist/objects}/guards.d.ts.map +0 -0
- /package/{objects → dist/objects}/index.d.ts +0 -0
- /package/{objects → dist/objects}/index.d.ts.map +0 -0
- /package/{promises → dist/promises}/abortable.d.ts +0 -0
- /package/{promises → dist/promises}/abortable.d.ts.map +0 -0
- /package/{promises → dist/promises}/compositions.d.ts +0 -0
- /package/{promises → dist/promises}/compositions.d.ts.map +0 -0
- /package/{promises → dist/promises}/guards.d.ts +0 -0
- /package/{promises → dist/promises}/guards.d.ts.map +0 -0
- /package/{promises → dist/promises}/index.d.ts +0 -0
- /package/{promises → dist/promises}/index.d.ts.map +0 -0
- /package/{promises → dist/promises}/pipe.d.ts +0 -0
- /package/{promises → dist/promises}/pipe.d.ts.map +0 -0
- /package/{promises → dist/promises}/poll.d.ts +0 -0
- /package/{promises → dist/promises}/poll.d.ts.map +0 -0
- /package/{promises → dist/promises}/retry.d.ts +0 -0
- /package/{promises → dist/promises}/retry.d.ts.map +0 -0
- /package/{promises → dist/promises}/types.d.ts +0 -0
- /package/{promises → dist/promises}/types.d.ts.map +0 -0
- /package/{serializer → dist/serializer}/constants.d.ts +0 -0
- /package/{serializer → dist/serializer}/constants.d.ts.map +0 -0
- /package/{serializer → dist/serializer}/index.d.ts +0 -0
- /package/{serializer → dist/serializer}/index.d.ts.map +0 -0
- /package/{serializer → dist/serializer}/serializers/index.d.ts +0 -0
- /package/{serializer → dist/serializer}/serializers/index.d.ts.map +0 -0
- /package/{serializer → dist/serializer}/symbol-registry.d.ts +0 -0
- /package/{serializer → dist/serializer}/symbol-registry.d.ts.map +0 -0
- /package/{strings → dist/strings}/constants.d.ts +0 -0
- /package/{strings → dist/strings}/constants.d.ts.map +0 -0
- /package/{strings → dist/strings}/factories.d.ts +0 -0
- /package/{strings → dist/strings}/factories.d.ts.map +0 -0
- /package/{strings → dist/strings}/guards.d.ts +0 -0
- /package/{strings → dist/strings}/guards.d.ts.map +0 -0
- /package/{strings → dist/strings}/index.d.ts +0 -0
- /package/{strings → dist/strings}/index.d.ts.map +0 -0
- /package/{strings → dist/strings}/manipulations.d.ts +0 -0
- /package/{strings → dist/strings}/manipulations.d.ts.map +0 -0
- /package/{strings → dist/strings}/types.d.ts +0 -0
- /package/{strings → dist/strings}/types.d.ts.map +0 -0
- /package/{system → dist/system}/env.d.ts +0 -0
- /package/{system → dist/system}/env.d.ts.map +0 -0
- /package/{system → dist/system}/graceful-exit.d.ts +0 -0
- /package/{system → dist/system}/graceful-exit.d.ts.map +0 -0
- /package/{system → dist/system}/index.d.ts +0 -0
- /package/{system → dist/system}/index.d.ts.map +0 -0
- /package/{system → dist/system}/path.d.ts +0 -0
- /package/{system → dist/system}/path.d.ts.map +0 -0
- /package/{times → dist/times}/constants.d.ts +0 -0
- /package/{times → dist/times}/constants.d.ts.map +0 -0
- /package/{times → dist/times}/factories.d.ts +0 -0
- /package/{times → dist/times}/factories.d.ts.map +0 -0
- /package/{times → dist/times}/guards.d.ts +0 -0
- /package/{times → dist/times}/guards.d.ts.map +0 -0
- /package/{times → dist/times}/index.d.ts +0 -0
- /package/{times → dist/times}/index.d.ts.map +0 -0
- /package/{times → dist/times}/operations.d.ts +0 -0
- /package/{times → dist/times}/operations.d.ts.map +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/serializer/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/serializer/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAA0B,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG1G,eAAO,MAAM,gBAAgB,GAAI,OAAO,IAAI,CAAC,eAAe,EAAE,gBAAgB,CAAC,KAAG,QAA4D,CAAA;AAE9I,wBAAgB,aAAa,CAAC,OAAO,GAAE,gBAAqB,GAAG,gBAAgB,CAiB9E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Jsonable } from '../core';
|
|
1
2
|
import type { SerializeContext, SerializeOptions } from './types';
|
|
2
|
-
import type { Jsonable } from '@/core';
|
|
3
3
|
import { OMIT_SENTINEL } from './constants';
|
|
4
4
|
export declare function serialize(value: unknown, options?: SerializeOptions): Jsonable;
|
|
5
5
|
export declare function serializeValue(value: unknown, ctx: SerializeContext): Jsonable | typeof OMIT_SENTINEL;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/serializer/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/serializer/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAO3C,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,QAAQ,CAS9E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAgB,GAAG,QAAQ,GAAG,OAAO,aAAa,CA8BrG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Jsonable } from '../../core';
|
|
1
2
|
import type { SerializeContext, SerializeValueFn } from '../types';
|
|
2
|
-
import type { Jsonable } from '@/core';
|
|
3
3
|
export declare function serializeArrayEntry(entry: unknown, ctx: SerializeContext, serializeValue: SerializeValueFn): Jsonable;
|
|
4
4
|
export declare const serializeArray: (value: unknown[], ctx: SerializeContext, serializeValue: SerializeValueFn) => Jsonable[];
|
|
5
5
|
export declare const serializeIterableEntries: (value: Iterable<unknown>, ctx: SerializeContext, serializeValue: SerializeValueFn) => Jsonable[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAGlE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,GAAG,QAAQ,CAIrH;AAED,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,EAAE,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,gBAAgB,KAAG,QAAQ,EAElH,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,OAAO,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,gBAAgB,KAAG,QAAQ,EAEpI,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import type { Jsonable } from '../../core';
|
|
1
2
|
import type { SerializeContext } from '../types';
|
|
2
|
-
import type { Jsonable } from '@/core';
|
|
3
3
|
export declare function serializeBinary(value: object, ctx: SerializeContext): Jsonable | undefined;
|
|
4
4
|
//# sourceMappingURL=binary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/binary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,GAAG,QAAQ,GAAG,SAAS,CAoB1F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import type { Jsonable } from '../../core';
|
|
1
2
|
import type { SerializeContext } from '../types';
|
|
2
|
-
import type { Jsonable } from '@/core';
|
|
3
3
|
export declare function serializeBlob(value: object, ctx: SerializeContext): Jsonable | undefined;
|
|
4
4
|
//# sourceMappingURL=blob.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blob.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/blob.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,GAAG,QAAQ,GAAG,SAAS,CAcxF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import type { Jsonable } from '../../core';
|
|
1
2
|
import type { SerializeContext, SerializeValueFn } from '../types';
|
|
2
|
-
import type { Jsonable } from '@/core';
|
|
3
3
|
export declare function serializeCollection(value: object, ctx: SerializeContext, serializeValue: SerializeValueFn): Jsonable | undefined;
|
|
4
4
|
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAIlE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,GAAG,QAAQ,GAAG,SAAS,CAmBhI"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Jsonable } from '../../core';
|
|
1
2
|
import type { SerializeContext, SerializeValueFn } from '../types';
|
|
2
|
-
import type { Jsonable } from '@/core';
|
|
3
3
|
import { type OMIT_SENTINEL } from '../constants';
|
|
4
4
|
export declare function serializeCompound(value: object, ctx: SerializeContext, serializeValue: SerializeValueFn): Jsonable | typeof OMIT_SENTINEL;
|
|
5
5
|
//# sourceMappingURL=compound.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compound.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/compound.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"compound.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/compound.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAKlE,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,cAAc,CAAA;AAS5D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,GAAG,QAAQ,GAAG,OAAO,aAAa,CA+DzI"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Jsonable } from '../../core';
|
|
1
2
|
import type { ErrorPropertyValue, SerializeContext, SerializeValueFn } from '../types';
|
|
2
|
-
import type { Jsonable } from '@/core';
|
|
3
3
|
export declare const isUsableValue: (value: ErrorPropertyValue) => value is Jsonable;
|
|
4
4
|
export declare function readProperty(error: Error, key: string | symbol, ctx: SerializeContext, serializeValue: SerializeValueFn): ErrorPropertyValue;
|
|
5
5
|
export declare function serializeErrorCoreFields(error: Error, ctx: SerializeContext, serializeValue: SerializeValueFn): Record<string, Jsonable>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAItF,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,KAAG,KAAK,IAAI,QAElE,CAAA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,GAAG,kBAAkB,CAY5I;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CA2BxI;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAsB9H"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import type { Jsonable } from '../../core';
|
|
1
2
|
import type { SerializeContext } from '../types';
|
|
2
|
-
import type { Jsonable } from '@/core';
|
|
3
3
|
export declare function serializeFunction(fn: (...args: unknown[]) => unknown, ctx: SerializeContext): Jsonable;
|
|
4
4
|
//# sourceMappingURL=function.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAGhD,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,GAAG,EAAE,gBAAgB,GAAG,QAAQ,CAQtG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import type { Jsonable } from '../../core';
|
|
1
2
|
import type { SerializeContext } from '../types';
|
|
2
|
-
import type { Jsonable } from '@/core';
|
|
3
3
|
export declare function serializeLeafObject(value: unknown, ctx: SerializeContext): Jsonable | undefined;
|
|
4
4
|
//# sourceMappingURL=leaf-object.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leaf-object.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/leaf-object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"leaf-object.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/leaf-object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAgB,GAAG,QAAQ,GAAG,SAAS,CAc/F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,GAAG,QAAQ,CAU9E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Jsonable } from '../../core';
|
|
1
2
|
import type { SerializeContext, SerializeValueFn } from '../types';
|
|
2
|
-
import type { Jsonable } from '@/core';
|
|
3
3
|
import { OMIT_SENTINEL } from '../constants';
|
|
4
4
|
export declare function handlePropertyAccessError(error: unknown, strategy: SerializeContext['onPropertyAccess'], key: string | symbol, ctx: SerializeContext): Jsonable | typeof OMIT_SENTINEL;
|
|
5
5
|
export declare function safeAccess(obj: object, key: string | symbol, strategy: SerializeContext['onPropertyAccess'], ctx: SerializeContext): unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,gBAAgB,GAAG,QAAQ,GAAG,OAAO,aAAa,CAUtL;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAM5I;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAqC9H"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import type { Jsonable } from '../../core';
|
|
1
2
|
import type { SerializeContext } from '../types';
|
|
2
|
-
import type { Jsonable } from '@/core';
|
|
3
3
|
export declare function serializeOpaque(value: unknown, ctx: SerializeContext): Jsonable | undefined;
|
|
4
4
|
//# sourceMappingURL=opaque.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opaque.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/opaque.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAIhD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAgB,GAAG,QAAQ,GAAG,SAAS,CA8B3F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import type { Jsonable } from '../../core';
|
|
1
2
|
import type { SerializeContext } from '../types';
|
|
2
|
-
import type { Jsonable } from '@/core';
|
|
3
3
|
export declare function serializePrimitive(value: unknown, ctx: SerializeContext): Jsonable | undefined;
|
|
4
4
|
//# sourceMappingURL=primitive.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitive.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/primitive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"primitive.d.ts","sourceRoot":"","sources":["../../../src/serializer/serializers/primitive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAIhD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAgB,GAAG,QAAQ,GAAG,SAAS,CA0B9F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/serializer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/serializer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,MAAM,WAAW,eAAe;IAC5B,cAAc,EAAE,IAAI,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,QAAQ,CAAA;CAClB;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE,gBAAgB,CAAC,KAAK,QAAQ,CAAA;AAE5F,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,aAAa,GAAG,OAAO,CAAA;AAErE,MAAM,WAAW,sBAAsB;IACnC,WAAW,CAAC,EAAE,sBAAsB,CAAA;IACpC,QAAQ,CAAC,EAAE,sBAAsB,CAAA;IACjC,cAAc,CAAC,EAAE,sBAAsB,CAAA;CAC1C;AAED,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,sBAAsB,GAAG,sBAAsB,CAAA;IACzD,gBAAgB,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,QAAQ,CAAC,GAAG,KAAK,CAAA;IACzD,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,aAAa,EAAE,sBAAsB,CAAA;IAC9C,QAAQ,CAAC,UAAU,EAAE,sBAAsB,CAAA;IAC3C,QAAQ,CAAC,gBAAgB,EAAE,sBAAsB,CAAA;IACjD,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,QAAQ,CAAC,GAAG,KAAK,CAAA;IACjE,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;IACpC,QAAQ,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAA;IACnD,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAChC;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAgB,KAAK,QAAQ,GAAG,OAAO,aAAa,CAAA;AAEzG,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,OAAO,aAAa,GAAG,SAAS,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Jsonable } from '../core';
|
|
1
2
|
import type { SerializeContext, SerializeErrorStrategy } from './types';
|
|
2
|
-
import type { Jsonable } from '@/core';
|
|
3
3
|
import { OMIT_SENTINEL } from './constants';
|
|
4
4
|
export declare function handleError(strategy: SerializeErrorStrategy, type: string, placeholder: string, ctx: SerializeContext): Jsonable | typeof OMIT_SENTINEL;
|
|
5
5
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/serializer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/serializer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,wBAAgB,WAAW,CAAC,QAAQ,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,GAAG,QAAQ,GAAG,OAAO,aAAa,CAUvJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { UrlLike } from '
|
|
2
|
-
import { type WithRetryOptions } from '
|
|
1
|
+
import type { UrlLike } from '../strings';
|
|
2
|
+
import { type WithRetryOptions } from '../promises';
|
|
3
3
|
export interface FetchOptions extends Omit<RequestInit, 'signal'> {
|
|
4
4
|
retry?: Omit<WithRetryOptions<Response>, 'signal'> & {
|
|
5
5
|
enabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/system/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/system/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGzC,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9D,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC;IAC7D,KAAK,CAAC,EAAE,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,GAAG;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAA;IACpF,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAsB,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,EAAE,EAAE,KAAY,EAAE,MAAM,EAAE,OAAgB,EAAE,GAAG,OAAO,EAAE,GAAE,YAAiB,qBAWpI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/system/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/system/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,GAAG,GAAG,MAAM,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Numberish } from '
|
|
1
|
+
import { type Numberish } from '../numbers';
|
|
2
2
|
export declare const toUnixTimestamp: (date: Date) => number;
|
|
3
3
|
export declare const fromUnixTimestamp: (timestamp: number) => Date;
|
|
4
4
|
export declare function formatDate(date: Date, format?: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversions.d.ts","sourceRoot":"","sources":["../../src/times/conversions.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"conversions.d.ts","sourceRoot":"","sources":["../../src/times/conversions.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAG9E,eAAO,MAAM,eAAe,GAAI,MAAM,IAAI,WAAsC,CAAA;AAEhF,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,SAA+B,CAAA;AAKlF,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,SAA4B,UAgBxE;AAWD,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,SAAS,UA8BhD;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAU1E;AAED,eAAO,MAAM,oBAAoB,GAAI,IAAI,SAAS,WAA2C,CAAA;AAE7F,eAAO,MAAM,eAAe,GAAI,GAAG,SAAS,WAA8C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kdtlabs/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"description": "A comprehensive TypeScript utility library",
|
|
6
6
|
"author": "Diep Dang <kdt310722@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -14,85 +14,23 @@
|
|
|
14
14
|
"sideEffects": false,
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"types": "./index.d.ts",
|
|
18
|
-
"default": "./index.js"
|
|
19
|
-
},
|
|
20
|
-
"./collections": {
|
|
21
|
-
"default": "./collections/index.js",
|
|
22
|
-
"types": "./collections/index.d.ts"
|
|
23
|
-
},
|
|
24
|
-
"./json-rpc": {
|
|
25
|
-
"default": "./json-rpc/index.js",
|
|
26
|
-
"types": "./json-rpc/index.d.ts"
|
|
27
|
-
},
|
|
28
|
-
"./objects": {
|
|
29
|
-
"default": "./objects/index.js",
|
|
30
|
-
"types": "./objects/index.d.ts"
|
|
31
|
-
},
|
|
32
|
-
"./times": {
|
|
33
|
-
"default": "./times/index.js",
|
|
34
|
-
"types": "./times/index.d.ts"
|
|
35
|
-
},
|
|
36
|
-
"./core": {
|
|
37
|
-
"default": "./core/index.js",
|
|
38
|
-
"types": "./core/index.d.ts"
|
|
39
|
-
},
|
|
40
|
-
"./numbers": {
|
|
41
|
-
"default": "./numbers/index.js",
|
|
42
|
-
"types": "./numbers/index.d.ts"
|
|
43
|
-
},
|
|
44
|
-
"./serializer": {
|
|
45
|
-
"default": "./serializer/index.js",
|
|
46
|
-
"types": "./serializer/index.d.ts"
|
|
47
|
-
},
|
|
48
|
-
"./strings": {
|
|
49
|
-
"default": "./strings/index.js",
|
|
50
|
-
"types": "./strings/index.d.ts"
|
|
51
|
-
},
|
|
52
|
-
"./buffers": {
|
|
53
|
-
"default": "./buffers/index.js",
|
|
54
|
-
"types": "./buffers/index.d.ts"
|
|
55
|
-
},
|
|
56
|
-
"./events": {
|
|
57
|
-
"default": "./events/index.js",
|
|
58
|
-
"types": "./events/index.d.ts"
|
|
59
|
-
},
|
|
60
|
-
"./errors": {
|
|
61
|
-
"default": "./errors/index.js",
|
|
62
|
-
"types": "./errors/index.d.ts"
|
|
63
|
-
},
|
|
64
|
-
"./functions": {
|
|
65
|
-
"default": "./functions/index.js",
|
|
66
|
-
"types": "./functions/index.d.ts"
|
|
67
|
-
},
|
|
68
|
-
"./arrays": {
|
|
69
|
-
"default": "./arrays/index.js",
|
|
70
|
-
"types": "./arrays/index.d.ts"
|
|
71
|
-
},
|
|
72
|
-
"./common": {
|
|
73
|
-
"default": "./common/index.js",
|
|
74
|
-
"types": "./common/index.d.ts"
|
|
75
|
-
},
|
|
76
|
-
"./system": {
|
|
77
|
-
"default": "./system/index.js",
|
|
78
|
-
"types": "./system/index.d.ts"
|
|
79
|
-
},
|
|
80
|
-
"./promises": {
|
|
81
|
-
"default": "./promises/index.js",
|
|
82
|
-
"types": "./promises/index.d.ts"
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
83
19
|
}
|
|
84
20
|
},
|
|
85
|
-
"main": "index.js",
|
|
86
|
-
"types": "index.d.ts",
|
|
21
|
+
"main": "dist/index.js",
|
|
22
|
+
"types": "dist/index.d.ts",
|
|
87
23
|
"files": [
|
|
88
|
-
"
|
|
24
|
+
"SKILL.md",
|
|
25
|
+
"dist",
|
|
26
|
+
"src"
|
|
89
27
|
],
|
|
90
28
|
"publishConfig": {
|
|
91
29
|
"access": "public"
|
|
92
30
|
},
|
|
93
31
|
"scripts": {
|
|
94
32
|
"build": "rimraf dist && bun run scripts/build.ts && tsc --project tsconfig.build.json",
|
|
95
|
-
"release": "bun run scripts/release.ts &&
|
|
33
|
+
"release": "bun run build && bun run scripts/release.ts && bunx npm publish",
|
|
96
34
|
"coverage": "bun test --coverage",
|
|
97
35
|
"lint": "eslint",
|
|
98
36
|
"lint:fix": "bun run lint --fix",
|
|
@@ -118,7 +56,7 @@
|
|
|
118
56
|
},
|
|
119
57
|
"simple-git-hooks": {
|
|
120
58
|
"commit-msg": "bunx --no -- commitlint --edit ${1}",
|
|
121
|
-
"pre-commit": "bunx lint-staged"
|
|
59
|
+
"pre-commit": "bunx lint-staged && bun run typecheck"
|
|
122
60
|
},
|
|
123
61
|
"lint-staged": {
|
|
124
62
|
"*": "bun run lint:fix"
|
|
@@ -126,4 +64,4 @@
|
|
|
126
64
|
"commitlint": {
|
|
127
65
|
"extends": "@commitlint/config-conventional"
|
|
128
66
|
}
|
|
129
|
-
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { EmptyArray, NonEmptyArray } from './types'
|
|
2
|
+
|
|
3
|
+
export function nth(array: EmptyArray, index: number): undefined
|
|
4
|
+
export function nth<T>(array: NonEmptyArray<T>, index: number): T
|
|
5
|
+
export function nth<T>(array: T[], index: number): T | undefined
|
|
6
|
+
|
|
7
|
+
export function nth<T>(array: T[], index: number): T | undefined {
|
|
8
|
+
return array.at(index)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function first(array: EmptyArray): undefined
|
|
12
|
+
export function first<T>(array: NonEmptyArray<T>): T
|
|
13
|
+
export function first<T>(array: T[]): T | undefined
|
|
14
|
+
|
|
15
|
+
export function first<T>(array: T[]): T | undefined {
|
|
16
|
+
return nth(array, 0)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function last(array: EmptyArray): undefined
|
|
20
|
+
export function last<T>(array: NonEmptyArray<T>): T
|
|
21
|
+
export function last<T>(array: T[]): T | undefined
|
|
22
|
+
|
|
23
|
+
export function last<T>(array: T[]): T | undefined {
|
|
24
|
+
return nth(array, -1)
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MaybeArray } from './types'
|
|
2
|
+
import { isIterable } from '../collections'
|
|
3
|
+
import { notNullish, type Nullable } from '../core'
|
|
4
|
+
import { isArray } from './guards'
|
|
5
|
+
|
|
6
|
+
export const wrap = <T>(array: T | T[]) => (isArray(array) ? array : [array])
|
|
7
|
+
|
|
8
|
+
export function toArray<T>(value?: Nullable<MaybeArray<T>>) {
|
|
9
|
+
if (isIterable(value)) {
|
|
10
|
+
return [...value]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return wrap(value ?? [])
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const compact = <T>(array: Array<Nullable<T>>): T[] => array.filter(notNullish)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EmptyArray, NonEmptyArray } from './types'
|
|
2
|
+
|
|
3
|
+
export const createArray = <T, TStrict extends boolean = true, TLength extends number = number>(length: TLength, value: (index: number) => T) => (
|
|
4
|
+
Array.from({ length }, (_, i) => value(i)) as TStrict extends false ? T[] : (TLength extends 0 ? EmptyArray : NonEmptyArray<T>)
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
export const range = (from: number, to: number, step = 1) => (
|
|
8
|
+
Array.from({ length: Math.floor((to - from) / step) + 1 }, (_, i) => from + (i * step))
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
export const sample = <T>(array: T[], quantity = 1) => (
|
|
12
|
+
Array.from({ length: quantity }, () => array[Math.floor(Math.random() * array.length)])
|
|
13
|
+
)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EmptyArray, NonEmptyArray } from './types'
|
|
2
|
+
|
|
3
|
+
export const isArray = <T = any>(value: unknown): value is T[] => Array.isArray(value)
|
|
4
|
+
|
|
5
|
+
export const isEmptyArray = <T = any, TStrict extends boolean = true>(value: T[]): value is (TStrict extends true ? EmptyArray : T[]) => value.length === 0
|
|
6
|
+
|
|
7
|
+
export const isNonEmptyArray = <T = any, TStrict extends boolean = true>(value: T[]): value is (TStrict extends true ? NonEmptyArray<T> : T[]) => !isEmptyArray(value)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { Nullable } from '../core'
|
|
2
|
+
import type { MaybeArray } from './types'
|
|
3
|
+
import { toArray } from './conversions'
|
|
4
|
+
|
|
5
|
+
export const merge = <T>(...arrays: Array<Nullable<MaybeArray<T>>>) => arrays.flatMap((array) => toArray(array))
|
|
6
|
+
|
|
7
|
+
export const flatten = <T>(array?: Nullable<MaybeArray<T | T[]>>) => toArray(array).flat() as T[]
|
|
8
|
+
|
|
9
|
+
export function shuffle<T>(array: T[]): T[] {
|
|
10
|
+
const result = [...array]
|
|
11
|
+
|
|
12
|
+
for (let i = result.length - 1; i > 0; i--) {
|
|
13
|
+
const j = Math.floor(Math.random() * (i + 1))
|
|
14
|
+
const temp = result[i]
|
|
15
|
+
|
|
16
|
+
result[i] = result[j]!
|
|
17
|
+
result[j] = temp!
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return result
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function groupBy<T, K extends PropertyKey>(array: T[], keyFn: (item: T) => K): Record<K, T[]> {
|
|
24
|
+
const result = {} as Record<K, T[]>
|
|
25
|
+
|
|
26
|
+
for (const item of array) {
|
|
27
|
+
const key = keyFn(item)
|
|
28
|
+
const group = result[key]
|
|
29
|
+
|
|
30
|
+
if (group) {
|
|
31
|
+
group.push(item)
|
|
32
|
+
} else {
|
|
33
|
+
result[key] = [item]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return result
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function keyBy<T, K extends PropertyKey>(array: T[], keyFn: (item: T) => K): Record<K, T> {
|
|
41
|
+
const result = {} as Record<K, T>
|
|
42
|
+
|
|
43
|
+
for (const item of array) {
|
|
44
|
+
result[keyFn(item)] = item
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return result
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function chunk<T>(array: T[], size: number): T[][] {
|
|
51
|
+
if (size <= 0 || !Number.isFinite(size)) {
|
|
52
|
+
throw new RangeError(`chunk size must be a positive finite number, got ${size}`)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const step = Math.floor(size)
|
|
56
|
+
const result: T[][] = []
|
|
57
|
+
|
|
58
|
+
for (let i = 0; i < array.length; i += step) {
|
|
59
|
+
result.push(array.slice(i, i + step))
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return result
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type SortDirection = 'asc' | 'desc'
|
|
66
|
+
|
|
67
|
+
export type SortKey<T> = ((item: T) => number | string) | { fn: (item: T) => number | string, order: SortDirection }
|
|
68
|
+
|
|
69
|
+
export function sortBy<T>(array: T[], ...keys: Array<SortKey<T>>): T[] {
|
|
70
|
+
const normalizedKeys = keys.map((key) => (typeof key === 'function' ? { fn: key, order: 'asc' as const } : key))
|
|
71
|
+
|
|
72
|
+
return array.toSorted((a, b) => {
|
|
73
|
+
for (const { fn, order } of normalizedKeys) {
|
|
74
|
+
const va = fn(a)
|
|
75
|
+
const vb = fn(b)
|
|
76
|
+
|
|
77
|
+
if (va < vb) {
|
|
78
|
+
return order === 'asc' ? -1 : 1
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (va > vb) {
|
|
82
|
+
return order === 'asc' ? 1 : -1
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return 0
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function partition<T>(array: T[], predicate: (item: T) => boolean): [T[], T[]] {
|
|
91
|
+
const pass: T[] = []
|
|
92
|
+
const fail: T[] = []
|
|
93
|
+
|
|
94
|
+
for (const item of array) {
|
|
95
|
+
if (predicate(item)) {
|
|
96
|
+
pass.push(item)
|
|
97
|
+
} else {
|
|
98
|
+
fail.push(item)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return [pass, fail]
|
|
103
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const unique = <T>(array: T[]) => [...new Set(array)]
|
|
2
|
+
|
|
3
|
+
export const uniqueBy = <T>(array: T[], equalFn: (a: T, b: T) => boolean) => (
|
|
4
|
+
array.reduce<T[]>((r, c) => (r.some((v) => equalFn(v, c)) ? r : [...r, c]), [])
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
export const intersection = <T>(a: T[], b: T[]) => a.filter((v) => b.includes(v))
|
|
8
|
+
|
|
9
|
+
export const diff = <T>(a: T[], b: T[]) => a.filter((v) => !b.includes(v))
|
|
10
|
+
|
|
11
|
+
export const symmetricDiff = <T>(a: T[], b: T[]) => [...diff(a, b), ...diff(b, a)]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type MaybeArray<T> = Iterable<T> | T | T[]
|
|
2
|
+
|
|
3
|
+
export type EmptyArray = []
|
|
4
|
+
|
|
5
|
+
export type NonEmptyArray<T> = [T, ...T[]]
|
|
6
|
+
|
|
7
|
+
export type ElementOf<T> = T extends Array<infer E> ? E : never
|
|
8
|
+
|
|
9
|
+
export type Head<T extends readonly unknown[]> = T extends readonly [infer H, ...unknown[]] ? H : never
|
|
10
|
+
|
|
11
|
+
export type Tail<T extends readonly unknown[]> = T extends readonly [unknown, ...infer R] ? R : []
|
|
12
|
+
|
|
13
|
+
export type Last<T extends readonly unknown[]> = T extends readonly [...unknown[], infer L] ? L : never
|
|
14
|
+
|
|
15
|
+
export type Flatten<T extends readonly unknown[]> = T extends ReadonlyArray<infer U> ? U extends ReadonlyArray<infer V> ? V[] : U[] : never
|
|
16
|
+
|
|
17
|
+
export type TupleToUnion<T extends readonly unknown[]> = T[number]
|
|
18
|
+
|
|
19
|
+
export type FixedLength<T, N extends number, R extends T[] = []> = R['length'] extends N ? R : FixedLength<T, N, [...R, T]>
|
|
20
|
+
|
|
21
|
+
export type ReadonlyNonEmptyArray<T> = readonly [T, ...T[]]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BufferLike } from './types'
|
|
2
|
+
import { isArrayBuffer, isBuffer, isSharedArrayBuffer } from './guards'
|
|
3
|
+
|
|
4
|
+
export function bufferToString(buffer: BufferLike, encoding: BufferEncoding = 'utf8') {
|
|
5
|
+
if (isBuffer(buffer)) {
|
|
6
|
+
return buffer.toString(encoding)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (isArrayBuffer(buffer) || isSharedArrayBuffer(buffer)) {
|
|
10
|
+
return Buffer.from(buffer).toString(encoding)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength).toString(encoding)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function toUint8Array(input: BufferLike) {
|
|
17
|
+
if (input instanceof Uint8Array) {
|
|
18
|
+
return input
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (input instanceof ArrayBuffer || input instanceof SharedArrayBuffer) {
|
|
22
|
+
return new Uint8Array(input)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return new Uint8Array(input.buffer, input.byteOffset, input.byteLength)
|
|
26
|
+
}
|