ts-data-forge 6.13.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/array/impl/array-utils-iterators.mjs +6 -0
- package/dist/array/impl/array-utils-iterators.mjs.map +1 -1
- package/dist/array/impl/array-utils-modification.mjs +6 -0
- package/dist/array/impl/array-utils-modification.mjs.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.mjs +6 -0
- package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
- package/dist/array/impl/array-utils-search.mjs +6 -0
- package/dist/array/impl/array-utils-search.mjs.map +1 -1
- package/dist/array/impl/array-utils-slice-clamped.mjs +6 -0
- package/dist/array/impl/array-utils-slice-clamped.mjs.map +1 -1
- package/dist/array/impl/array-utils-slicing.mjs +6 -0
- package/dist/array/impl/array-utils-slicing.mjs.map +1 -1
- package/dist/array/impl/array-utils-transformation.mjs +6 -0
- package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
- package/dist/array/impl/array-utils-validation.mjs +6 -0
- package/dist/array/impl/array-utils-validation.mjs.map +1 -1
- package/dist/collections/imap-mapped.mjs +6 -0
- package/dist/collections/imap-mapped.mjs.map +1 -1
- package/dist/collections/imap.mjs +6 -0
- package/dist/collections/imap.mjs.map +1 -1
- package/dist/collections/iset-mapped.mjs +6 -0
- package/dist/collections/iset-mapped.mjs.map +1 -1
- package/dist/collections/iset.mjs +6 -0
- package/dist/collections/iset.mjs.map +1 -1
- package/dist/collections/queue.mjs +6 -0
- package/dist/collections/queue.mjs.map +1 -1
- package/dist/collections/stack.mjs +6 -0
- package/dist/collections/stack.mjs.map +1 -1
- package/dist/entry-point.mjs +6 -0
- package/dist/entry-point.mjs.map +1 -1
- package/dist/functional/pipe.d.mts +6 -18
- package/dist/functional/pipe.d.mts.map +1 -1
- package/dist/functional/pipe.mjs +35 -15
- package/dist/functional/pipe.mjs.map +1 -1
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -1
- package/dist/iterator/range.mjs +6 -0
- package/dist/iterator/range.mjs.map +1 -1
- package/dist/json/json.mjs +6 -0
- package/dist/json/json.mjs.map +1 -1
- package/dist/number/branded-types/finite-number.d.mts +1 -1
- package/dist/number/branded-types/index.d.mts +6 -0
- package/dist/number/branded-types/index.d.mts.map +1 -1
- package/dist/number/branded-types/index.mjs +6 -0
- package/dist/number/branded-types/index.mjs.map +1 -1
- package/dist/number/branded-types/int.d.mts +1 -2
- package/dist/number/branded-types/int.d.mts.map +1 -1
- package/dist/number/branded-types/int16.d.mts +2 -3
- package/dist/number/branded-types/int16.d.mts.map +1 -1
- package/dist/number/branded-types/int32.d.mts +2 -3
- package/dist/number/branded-types/int32.d.mts.map +1 -1
- package/dist/number/branded-types/negative-finite-number.d.mts +143 -0
- package/dist/number/branded-types/negative-finite-number.d.mts.map +1 -0
- package/dist/number/branded-types/negative-finite-number.mjs +156 -0
- package/dist/number/branded-types/negative-finite-number.mjs.map +1 -0
- package/dist/number/branded-types/negative-int.d.mts +120 -0
- package/dist/number/branded-types/negative-int.d.mts.map +1 -0
- package/dist/number/branded-types/negative-int.mjs +125 -0
- package/dist/number/branded-types/negative-int.mjs.map +1 -0
- package/dist/number/branded-types/negative-safe-int.d.mts +132 -0
- package/dist/number/branded-types/negative-safe-int.d.mts.map +1 -0
- package/dist/number/branded-types/negative-safe-int.mjs +136 -0
- package/dist/number/branded-types/negative-safe-int.mjs.map +1 -0
- package/dist/number/branded-types/non-negative-finite-number.d.mts +1 -1
- package/dist/number/branded-types/non-negative-int16.d.mts +1 -1
- package/dist/number/branded-types/non-negative-int32.d.mts +1 -1
- package/dist/number/branded-types/non-positive-finite-number.d.mts +130 -0
- package/dist/number/branded-types/non-positive-finite-number.d.mts.map +1 -0
- package/dist/number/branded-types/non-positive-finite-number.mjs +134 -0
- package/dist/number/branded-types/non-positive-finite-number.mjs.map +1 -0
- package/dist/number/branded-types/non-positive-int.d.mts +224 -0
- package/dist/number/branded-types/non-positive-int.d.mts.map +1 -0
- package/dist/number/branded-types/non-positive-int.mjs +222 -0
- package/dist/number/branded-types/non-positive-int.mjs.map +1 -0
- package/dist/number/branded-types/non-positive-safe-int.d.mts +119 -0
- package/dist/number/branded-types/non-positive-safe-int.d.mts.map +1 -0
- package/dist/number/branded-types/non-positive-safe-int.mjs +116 -0
- package/dist/number/branded-types/non-positive-safe-int.mjs.map +1 -0
- package/dist/number/branded-types/non-zero-finite-number.d.mts +5 -17
- package/dist/number/branded-types/non-zero-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-finite-number.mjs +5 -17
- package/dist/number/branded-types/non-zero-finite-number.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int.d.mts +5 -33
- package/dist/number/branded-types/non-zero-int.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-int.mjs +5 -25
- package/dist/number/branded-types/non-zero-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int16.d.mts +6 -43
- package/dist/number/branded-types/non-zero-int16.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-int16.mjs +5 -25
- package/dist/number/branded-types/non-zero-int16.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-int32.d.mts +6 -39
- package/dist/number/branded-types/non-zero-int32.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-int32.mjs +5 -25
- package/dist/number/branded-types/non-zero-int32.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-safe-int.d.mts +5 -37
- package/dist/number/branded-types/non-zero-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-safe-int.mjs +5 -28
- package/dist/number/branded-types/non-zero-safe-int.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-uint16.d.mts +6 -33
- package/dist/number/branded-types/non-zero-uint16.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-uint16.mjs +5 -17
- package/dist/number/branded-types/non-zero-uint16.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-uint32.d.mts +6 -31
- package/dist/number/branded-types/non-zero-uint32.d.mts.map +1 -1
- package/dist/number/branded-types/non-zero-uint32.mjs +5 -17
- package/dist/number/branded-types/non-zero-uint32.mjs.map +1 -1
- package/dist/number/branded-types/positive-finite-number.d.mts +4 -2
- package/dist/number/branded-types/positive-finite-number.d.mts.map +1 -1
- package/dist/number/branded-types/positive-int.d.mts +4 -2
- package/dist/number/branded-types/positive-int.d.mts.map +1 -1
- package/dist/number/branded-types/positive-int16.d.mts +4 -2
- package/dist/number/branded-types/positive-int16.d.mts.map +1 -1
- package/dist/number/branded-types/positive-int32.d.mts +4 -2
- package/dist/number/branded-types/positive-int32.d.mts.map +1 -1
- package/dist/number/branded-types/positive-safe-int.d.mts +4 -2
- package/dist/number/branded-types/positive-safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/positive-uint16.d.mts +4 -2
- package/dist/number/branded-types/positive-uint16.d.mts.map +1 -1
- package/dist/number/branded-types/positive-uint32.d.mts +4 -2
- package/dist/number/branded-types/positive-uint32.d.mts.map +1 -1
- package/dist/number/branded-types/safe-int.d.mts +1 -2
- package/dist/number/branded-types/safe-int.d.mts.map +1 -1
- package/dist/number/branded-types/safe-uint.d.mts +1 -1
- package/dist/number/branded-types/uint.d.mts +1 -1
- package/dist/number/branded-types/uint16.d.mts +1 -1
- package/dist/number/branded-types/uint32.d.mts +1 -1
- package/dist/number/index.d.mts +1 -0
- package/dist/number/index.d.mts.map +1 -1
- package/dist/number/index.mjs +6 -0
- package/dist/number/index.mjs.map +1 -1
- package/dist/number/num-arithmetic-types.d.mts +74 -0
- package/dist/number/num-arithmetic-types.d.mts.map +1 -0
- package/dist/number/num-arithmetic-types.mjs +2 -0
- package/dist/number/num-arithmetic-types.mjs.map +1 -0
- package/dist/number/num.d.mts +53 -9
- package/dist/number/num.d.mts.map +1 -1
- package/dist/number/num.mjs +64 -12
- package/dist/number/num.mjs.map +1 -1
- package/dist/number/refined-number-utils.d.mts +12 -9
- package/dist/number/refined-number-utils.d.mts.map +1 -1
- package/dist/number/refined-number-utils.mjs.map +1 -1
- package/dist/object/object.mjs +6 -0
- package/dist/object/object.mjs.map +1 -1
- package/package.json +5 -2
- package/src/functional/pipe.mts +104 -78
- package/src/functional/pipe.test.mts +57 -1
- package/src/number/branded-types/index.mts +6 -0
- package/src/number/branded-types/negative-finite-number.mts +210 -0
- package/src/number/branded-types/negative-finite-number.test.mts +172 -0
- package/src/number/branded-types/negative-int.mts +160 -0
- package/src/number/branded-types/negative-int.test.mts +146 -0
- package/src/number/branded-types/negative-safe-int.mts +173 -0
- package/src/number/branded-types/negative-safe-int.test.mts +120 -0
- package/src/number/branded-types/non-positive-finite-number.mts +191 -0
- package/src/number/branded-types/non-positive-finite-number.test.mts +286 -0
- package/src/number/branded-types/non-positive-int.mts +251 -0
- package/src/number/branded-types/non-positive-int.test.mts +197 -0
- package/src/number/branded-types/non-positive-safe-int.mts +147 -0
- package/src/number/branded-types/non-positive-safe-int.test.mts +223 -0
- package/src/number/branded-types/non-zero-finite-number.mts +14 -22
- package/src/number/branded-types/non-zero-finite-number.test.mts +0 -12
- package/src/number/branded-types/non-zero-int.mts +10 -32
- package/src/number/branded-types/non-zero-int.test.mts +0 -20
- package/src/number/branded-types/non-zero-int16.mts +8 -32
- package/src/number/branded-types/non-zero-int16.test.mts +0 -30
- package/src/number/branded-types/non-zero-int32.mts +8 -32
- package/src/number/branded-types/non-zero-int32.test.mts +0 -30
- package/src/number/branded-types/non-zero-safe-int.mts +8 -35
- package/src/number/branded-types/non-zero-safe-int.test.mts +0 -32
- package/src/number/branded-types/non-zero-uint16.mts +8 -22
- package/src/number/branded-types/non-zero-uint16.test.mts +0 -16
- package/src/number/branded-types/non-zero-uint32.mts +8 -22
- package/src/number/branded-types/non-zero-uint32.test.mts +0 -16
- package/src/number/index.mts +1 -0
- package/src/number/num-arithmetic-types.mts +269 -0
- package/src/number/num-arithmetic-types.test.mts +130 -0
- package/src/number/num-arithmetic.test.mts +102 -0
- package/src/number/num.mts +96 -15
- package/src/number/refined-number-utils.mts +19 -9
- package/src/others/map-nullable.test.mts +3 -4
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type MergeIntersection } from 'ts-type-forge';
|
|
2
1
|
import { Optional, type UnknownOptional } from './optional/index.mjs';
|
|
3
2
|
/**
|
|
4
3
|
* Creates a new pipe object that allows for chaining operations on a value.
|
|
@@ -18,15 +17,8 @@ import { Optional, type UnknownOptional } from './optional/index.mjs';
|
|
|
18
17
|
* @param a The initial value to wrap in a pipe.
|
|
19
18
|
* @returns A pipe object with chaining methods appropriate for the value type.
|
|
20
19
|
*/
|
|
21
|
-
export declare
|
|
22
|
-
export
|
|
23
|
-
type Pipe<A> = A extends UnknownOptional ? PipeWithMapOptional<A> : PipeBase<A>;
|
|
24
|
-
/**
|
|
25
|
-
* @template A The type of the current value in the pipe.
|
|
26
|
-
* @internal
|
|
27
|
-
* Base pipe interface providing core functionality.
|
|
28
|
-
* All pipe types extend this interface.
|
|
29
|
-
*/
|
|
20
|
+
export declare const pipe: <const A>(a: A) => Pipe<A>;
|
|
21
|
+
export type Pipe<A> = PipeBase<A> & PipeMapNullable<A> & ([A] extends [UnknownOptional] ? PipeMapOptional<A> : unknown);
|
|
30
22
|
type PipeBase<A> = Readonly<{
|
|
31
23
|
/** The current value being piped. */
|
|
32
24
|
value: A;
|
|
@@ -48,6 +40,8 @@ type PipeBase<A> = Readonly<{
|
|
|
48
40
|
* @returns A new pipe containing the transformed value.
|
|
49
41
|
*/
|
|
50
42
|
map: <B>(fn: (a: A) => B) => Pipe<B>;
|
|
43
|
+
}>;
|
|
44
|
+
type PipeMapNullable<A> = Readonly<{
|
|
51
45
|
/**
|
|
52
46
|
* Maps the current value only if it's not null or undefined. If the current
|
|
53
47
|
* value is null/undefined, the transformation is skipped and undefined is
|
|
@@ -75,13 +69,7 @@ type PipeBase<A> = Readonly<{
|
|
|
75
69
|
*/
|
|
76
70
|
mapNullable: <B>(fn: (a: NonNullable<A>) => B) => Pipe<B | undefined>;
|
|
77
71
|
}>;
|
|
78
|
-
|
|
79
|
-
* @template A The Optional type currently in the pipe.
|
|
80
|
-
* @internal
|
|
81
|
-
* Pipe interface for Optional values, providing Optional-aware mapping.
|
|
82
|
-
* Extends PipeBase with mapOptional functionality for monadic operations.
|
|
83
|
-
*/
|
|
84
|
-
type PipeWithMapOptional<A extends UnknownOptional> = MergeIntersection<PipeBase<A> & Readonly<{
|
|
72
|
+
type PipeMapOptional<A extends UnknownOptional> = Readonly<{
|
|
85
73
|
/**
|
|
86
74
|
* Maps the value inside an Optional using Optional.map semantics. If the
|
|
87
75
|
* Optional is None, the transformation is skipped and None is propagated.
|
|
@@ -109,6 +97,6 @@ type PipeWithMapOptional<A extends UnknownOptional> = MergeIntersection<PipeBase
|
|
|
109
97
|
* @returns A new pipe containing an Optional with the transformed value.
|
|
110
98
|
*/
|
|
111
99
|
mapOptional: <B>(fn: (a: Optional.Unwrap<A>) => B) => Pipe<Optional<B>>;
|
|
112
|
-
}
|
|
100
|
+
}>;
|
|
113
101
|
export {};
|
|
114
102
|
//# sourceMappingURL=pipe.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipe.d.mts","sourceRoot":"","sources":["../../src/functional/pipe.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pipe.d.mts","sourceRoot":"","sources":["../../src/functional/pipe.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEtE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,IAAI,GAAI,KAAK,CAAC,CAAC,EAAG,GAAG,CAAC,KAAG,IAAI,CAAC,CAAC,CAYI,CAAC;AAmBjD,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAC/B,eAAe,CAAC,CAAC,CAAC,GAClB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;AAgCjE,KAAK,QAAQ,CAAC,CAAC,IAAI,QAAQ,CAAC;IAC1B,qCAAqC;IACrC,KAAK,EAAE,CAAC,CAAC;IAET;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;CACtC,CAAC,CAAC;AAEH,KAAK,eAAe,CAAC,CAAC,IAAI,QAAQ,CAAC;IACjC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;CACvE,CAAC,CAAC;AAEH,KAAK,eAAe,CAAC,CAAC,SAAS,eAAe,IAAI,QAAQ,CAAC;IACzD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;CACzE,CAAC,CAAC"}
|
package/dist/functional/pipe.mjs
CHANGED
|
@@ -1,22 +1,42 @@
|
|
|
1
1
|
import { isOptional } from './optional/impl/optional-is-optional.mjs';
|
|
2
2
|
import { map } from './optional/impl/optional-map.mjs';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new pipe object that allows for chaining operations on a value.
|
|
6
|
+
*
|
|
7
|
+
* This function provides a fluent interface for applying transformations to
|
|
8
|
+
* values, with intelligent method selection based on the input type:
|
|
9
|
+
*
|
|
10
|
+
* - For `Optional` values: Provides `mapOptional` for safe Optional
|
|
11
|
+
* transformations
|
|
12
|
+
* - For other values: Provides `mapNullable` for null-safe transformations
|
|
13
|
+
* - All types get the basic `map` method for general transformations
|
|
14
|
+
*
|
|
15
|
+
* The pipe maintains type safety throughout the chain, automatically selecting
|
|
16
|
+
* the appropriate overload based on the current value type.
|
|
17
|
+
*
|
|
18
|
+
* @template A The type of the initial value to wrap in a pipe.
|
|
19
|
+
* @param a The initial value to wrap in a pipe.
|
|
20
|
+
* @returns A pipe object with chaining methods appropriate for the value type.
|
|
21
|
+
*/
|
|
22
|
+
const pipe = (a) =>
|
|
23
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
24
|
+
({
|
|
25
|
+
value: a,
|
|
26
|
+
map: (fn) => pipe(fn(a)),
|
|
27
|
+
mapNullable: (fn) => pipe(a == null ? undefined : fn(a)),
|
|
28
|
+
...(isOptional(a)
|
|
29
|
+
? {
|
|
9
30
|
mapOptional: (fn) => pipe(map(a, fn)),
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
31
|
+
}
|
|
32
|
+
: {}),
|
|
33
|
+
});
|
|
34
|
+
// NOTE: 以下では 'typing when used with generics' test で型エラーが出る。
|
|
35
|
+
// 詳細は documents/reports/pipe-typing.md の 「mapNullable を条件付きで含めるのがうまくいかない理由」を参照。
|
|
36
|
+
// export type Pipe<A> = PipeBase<A> &
|
|
37
|
+
// ([A] extends [UnknownOptional] ? PipeMapOptional<A> : unknown) &
|
|
38
|
+
// ([undefined] extends [A] ? PipeMapNullable<A> : unknown) &
|
|
39
|
+
// ([null] extends [A] ? PipeMapNullable<A> : unknown);
|
|
20
40
|
|
|
21
41
|
export { pipe };
|
|
22
42
|
//# sourceMappingURL=pipe.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipe.mjs","sources":["../../src/functional/pipe.mts"],"sourcesContent":[null],"names":["Optional.isOptional","Optional.map"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"pipe.mjs","sources":["../../src/functional/pipe.mts"],"sourcesContent":[null],"names":["Optional.isOptional","Optional.map"],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;AAiBG;AACI,MAAM,IAAI,GAAG,CAAW,CAAI;AACjC;AACA,CAAC;AACC,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,GAAG,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxB,WAAW,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,IAAI,IAAI,GAAG,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;AAExD,IAAA,IAAIA,UAAmB,CAAC,CAAC;AACvB,UAAE;AACE,YAAA,WAAW,EAAE,CAAC,EAAE,KAAK,IAAI,CAACC,GAAY,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/C;UACD,EAAE,CAAC;AACR,CAAA;AAuBH;AACA;AACA;AACA;AACA;AACA;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -18,9 +18,15 @@ export { FiniteNumber, asFiniteNumber, isFiniteNumber } from './number/branded-t
|
|
|
18
18
|
export { Int, asInt, isInt } from './number/branded-types/int.mjs';
|
|
19
19
|
export { Int16, asInt16, isInt16 } from './number/branded-types/int16.mjs';
|
|
20
20
|
export { Int32, asInt32, isInt32 } from './number/branded-types/int32.mjs';
|
|
21
|
+
export { NegativeFiniteNumber, asNegativeFiniteNumber, isNegativeFiniteNumber } from './number/branded-types/negative-finite-number.mjs';
|
|
22
|
+
export { NegativeInt, asNegativeInt, isNegativeInt } from './number/branded-types/negative-int.mjs';
|
|
23
|
+
export { NegativeSafeInt, asNegativeSafeInt, isNegativeSafeInt } from './number/branded-types/negative-safe-int.mjs';
|
|
21
24
|
export { NonNegativeFiniteNumber, asNonNegativeFiniteNumber, isNonNegativeFiniteNumber } from './number/branded-types/non-negative-finite-number.mjs';
|
|
22
25
|
export { NonNegativeInt16, asNonNegativeInt16, isNonNegativeInt16 } from './number/branded-types/non-negative-int16.mjs';
|
|
23
26
|
export { NonNegativeInt32, asNonNegativeInt32, isNonNegativeInt32 } from './number/branded-types/non-negative-int32.mjs';
|
|
27
|
+
export { NonPositiveFiniteNumber, asNonPositiveFiniteNumber, isNonPositiveFiniteNumber } from './number/branded-types/non-positive-finite-number.mjs';
|
|
28
|
+
export { NonPositiveInt, asNonPositiveInt, isNonPositiveInt } from './number/branded-types/non-positive-int.mjs';
|
|
29
|
+
export { NonPositiveSafeInt, asNonPositiveSafeInt, isNonPositiveSafeInt } from './number/branded-types/non-positive-safe-int.mjs';
|
|
24
30
|
export { NonZeroFiniteNumber, asNonZeroFiniteNumber, isNonZeroFiniteNumber } from './number/branded-types/non-zero-finite-number.mjs';
|
|
25
31
|
export { NonZeroInt, asNonZeroInt, isNonZeroInt } from './number/branded-types/non-zero-int.mjs';
|
|
26
32
|
export { NonZeroInt16, asNonZeroInt16, isNonZeroInt16 } from './number/branded-types/non-zero-int16.mjs';
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/iterator/range.mjs
CHANGED
|
@@ -2,9 +2,15 @@ import '../number/branded-types/finite-number.mjs';
|
|
|
2
2
|
import '../number/branded-types/int.mjs';
|
|
3
3
|
import '../number/branded-types/int16.mjs';
|
|
4
4
|
import '../number/branded-types/int32.mjs';
|
|
5
|
+
import '../number/branded-types/negative-finite-number.mjs';
|
|
6
|
+
import '../number/branded-types/negative-int.mjs';
|
|
7
|
+
import '../number/branded-types/negative-safe-int.mjs';
|
|
5
8
|
import '../number/branded-types/non-negative-finite-number.mjs';
|
|
6
9
|
import '../number/branded-types/non-negative-int16.mjs';
|
|
7
10
|
import '../number/branded-types/non-negative-int32.mjs';
|
|
11
|
+
import '../number/branded-types/non-positive-finite-number.mjs';
|
|
12
|
+
import '../number/branded-types/non-positive-int.mjs';
|
|
13
|
+
import '../number/branded-types/non-positive-safe-int.mjs';
|
|
8
14
|
import '../number/branded-types/non-zero-finite-number.mjs';
|
|
9
15
|
import '../number/branded-types/non-zero-int.mjs';
|
|
10
16
|
import '../number/branded-types/non-zero-int16.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range.mjs","sources":["../../src/iterator/range.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"range.mjs","sources":["../../src/iterator/range.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAsFiB,KAAK,CACpB,GAAG,IAME,EAAA;AAEL,IAAA,QAAQ,IAAI,CAAC,MAAM;QACjB,KAAK,CAAC,EAAE;AACN,YAAA,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI;AAElB,YAAA,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE;AAChC,gBAAA,MAAM,CAAC;YACT;YAEA;QACF;AAEA,QAAA,KAAK,CAAC;;QAGN,KAAK,CAAC,EAAE;YACN,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI;AAEnC,YAAA,KACE,IAAI,KAAK,GAAY,SAAS,CAAC,KAAK,CAAC,EACrC,IAAI,GAAG,CAAC,GAAG,KAAK,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG,EACpC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,EAC3C;AACA,gBAAA,MAAM,KAAK;YACb;QACF;;AAEJ;;;;"}
|
package/dist/json/json.mjs
CHANGED
|
@@ -2,9 +2,15 @@ import '../number/branded-types/finite-number.mjs';
|
|
|
2
2
|
import '../number/branded-types/int.mjs';
|
|
3
3
|
import '../number/branded-types/int16.mjs';
|
|
4
4
|
import '../number/branded-types/int32.mjs';
|
|
5
|
+
import '../number/branded-types/negative-finite-number.mjs';
|
|
6
|
+
import '../number/branded-types/negative-int.mjs';
|
|
7
|
+
import '../number/branded-types/negative-safe-int.mjs';
|
|
5
8
|
import '../number/branded-types/non-negative-finite-number.mjs';
|
|
6
9
|
import '../number/branded-types/non-negative-int16.mjs';
|
|
7
10
|
import '../number/branded-types/non-negative-int32.mjs';
|
|
11
|
+
import '../number/branded-types/non-positive-finite-number.mjs';
|
|
12
|
+
import '../number/branded-types/non-positive-int.mjs';
|
|
13
|
+
import '../number/branded-types/non-positive-safe-int.mjs';
|
|
8
14
|
import '../number/branded-types/non-zero-finite-number.mjs';
|
|
9
15
|
import '../number/branded-types/non-zero-int.mjs';
|
|
10
16
|
import '../number/branded-types/non-zero-int16.mjs';
|
package/dist/json/json.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.mjs","sources":["../../src/json/json.mts"],"sourcesContent":[null],"names":["Result.ok","Result.err","Arr.uniq"],"mappings":"
|
|
1
|
+
{"version":3,"file":"json.mjs","sources":["../../src/json/json.mts"],"sourcesContent":[null],"names":["Result.ok","Result.err","Arr.uniq"],"mappings":"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"}
|
|
@@ -58,7 +58,7 @@ export declare const FiniteNumber: {
|
|
|
58
58
|
* @param x - The finite number to get the absolute value of
|
|
59
59
|
* @returns The absolute value as a FiniteNumber
|
|
60
60
|
*/
|
|
61
|
-
readonly abs: (x: TtfImported_FiniteNumber) =>
|
|
61
|
+
readonly abs: (x: TtfImported_FiniteNumber) => import("ts-type-forge").IntersectBrand<TtfImported_FiniteNumber, import("ts-type-forge").NonNegativeNumber>;
|
|
62
62
|
/**
|
|
63
63
|
* Returns the minimum value from a list of finite numbers.
|
|
64
64
|
*
|
|
@@ -2,9 +2,15 @@ export * from './finite-number.mjs';
|
|
|
2
2
|
export * from './int.mjs';
|
|
3
3
|
export * from './int16.mjs';
|
|
4
4
|
export * from './int32.mjs';
|
|
5
|
+
export * from './negative-finite-number.mjs';
|
|
6
|
+
export * from './negative-int.mjs';
|
|
7
|
+
export * from './negative-safe-int.mjs';
|
|
5
8
|
export * from './non-negative-finite-number.mjs';
|
|
6
9
|
export * from './non-negative-int16.mjs';
|
|
7
10
|
export * from './non-negative-int32.mjs';
|
|
11
|
+
export * from './non-positive-finite-number.mjs';
|
|
12
|
+
export * from './non-positive-int.mjs';
|
|
13
|
+
export * from './non-positive-safe-int.mjs';
|
|
8
14
|
export * from './non-zero-finite-number.mjs';
|
|
9
15
|
export * from './non-zero-int.mjs';
|
|
10
16
|
export * from './non-zero-int16.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/index.mts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/index.mts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
@@ -2,9 +2,15 @@ export { FiniteNumber, asFiniteNumber, isFiniteNumber } from './finite-number.mj
|
|
|
2
2
|
export { Int, asInt, isInt } from './int.mjs';
|
|
3
3
|
export { Int16, asInt16, isInt16 } from './int16.mjs';
|
|
4
4
|
export { Int32, asInt32, isInt32 } from './int32.mjs';
|
|
5
|
+
export { NegativeFiniteNumber, asNegativeFiniteNumber, isNegativeFiniteNumber } from './negative-finite-number.mjs';
|
|
6
|
+
export { NegativeInt, asNegativeInt, isNegativeInt } from './negative-int.mjs';
|
|
7
|
+
export { NegativeSafeInt, asNegativeSafeInt, isNegativeSafeInt } from './negative-safe-int.mjs';
|
|
5
8
|
export { NonNegativeFiniteNumber, asNonNegativeFiniteNumber, isNonNegativeFiniteNumber } from './non-negative-finite-number.mjs';
|
|
6
9
|
export { NonNegativeInt16, asNonNegativeInt16, isNonNegativeInt16 } from './non-negative-int16.mjs';
|
|
7
10
|
export { NonNegativeInt32, asNonNegativeInt32, isNonNegativeInt32 } from './non-negative-int32.mjs';
|
|
11
|
+
export { NonPositiveFiniteNumber, asNonPositiveFiniteNumber, isNonPositiveFiniteNumber } from './non-positive-finite-number.mjs';
|
|
12
|
+
export { NonPositiveInt, asNonPositiveInt, isNonPositiveInt } from './non-positive-int.mjs';
|
|
13
|
+
export { NonPositiveSafeInt, asNonPositiveSafeInt, isNonPositiveSafeInt } from './non-positive-safe-int.mjs';
|
|
8
14
|
export { NonZeroFiniteNumber, asNonZeroFiniteNumber, isNonZeroFiniteNumber } from './non-zero-finite-number.mjs';
|
|
9
15
|
export { NonZeroInt, asNonZeroInt, isNonZeroInt } from './non-zero-int.mjs';
|
|
10
16
|
export { NonZeroInt16, asNonZeroInt16, isNonZeroInt16 } from './non-zero-int16.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type Int as TtfImported_Int } from 'ts-type-forge';
|
|
2
|
-
import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
3
2
|
export type Int = TtfImported_Int;
|
|
4
3
|
/**
|
|
5
4
|
* Type guard that checks if a value is an integer.
|
|
@@ -102,7 +101,7 @@ export declare const Int: {
|
|
|
102
101
|
* @param a - The integer value
|
|
103
102
|
* @returns The absolute value as a non-negative Int
|
|
104
103
|
*/
|
|
105
|
-
readonly abs: (x: import("ts-type-forge").WithSmallInt<TtfImported_Int>) =>
|
|
104
|
+
readonly abs: (x: import("ts-type-forge").WithSmallInt<TtfImported_Int>) => import("ts-type-forge").IntersectBrand<TtfImported_Int, import("ts-type-forge").NonNegativeNumber>;
|
|
106
105
|
/**
|
|
107
106
|
* Returns the minimum value from a list of integers.
|
|
108
107
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"int.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAI5D,MAAM,MAAM,GAAG,GAAG,eAAe,CAAC;AA6BlC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,KAAK,qCAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,KAAK;;;;;;MAAW,CAAC;AAE9B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,GAAG;IACd;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;;;;;;OAqBG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;OAaG;;IAGH;;;;;;;;;;;;;;;;;;;;;;;OAuBG;;IAGH;;;;;;;;;;;;;;;;;;OAkBG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;OAcG;;IAGH;;;;;;;;;;;;;;;;;;;;;OAqBG;;;;;;;;;CAEK,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type Int16 as TtfImported_Int16 } from 'ts-type-forge';
|
|
2
|
-
import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
3
2
|
export type Int16 = TtfImported_Int16;
|
|
4
3
|
/**
|
|
5
4
|
* Checks if a number is an Int16 (16-bit signed integer in the range [-2^15,
|
|
@@ -66,7 +65,7 @@ export declare const Int16: {
|
|
|
66
65
|
* @param a The Int16 value.
|
|
67
66
|
* @returns The absolute value as an Int16, clamped to valid range.
|
|
68
67
|
*/
|
|
69
|
-
readonly abs: (x: import("ts-type-forge").WithSmallInt<TtfImported_Int16>) =>
|
|
68
|
+
readonly abs: (x: import("ts-type-forge").WithSmallInt<TtfImported_Int16>) => import("ts-type-forge").IntersectBrand<TtfImported_Int16, import("ts-type-forge").NonNegativeNumber>;
|
|
70
69
|
/**
|
|
71
70
|
* Returns the smaller of two Int16 values.
|
|
72
71
|
*
|
|
@@ -139,11 +138,11 @@ export declare const Int16: {
|
|
|
139
138
|
readonly NaNValue: false;
|
|
140
139
|
readonly Finite: true;
|
|
141
140
|
readonly Int: true;
|
|
142
|
-
readonly "!=0": true;
|
|
143
141
|
readonly "> -2^16": true;
|
|
144
142
|
readonly "> -2^32": true;
|
|
145
143
|
readonly ">= -2^15": true;
|
|
146
144
|
readonly ">= -2^31": true;
|
|
145
|
+
readonly "!=0": true;
|
|
147
146
|
readonly "< 2^15": true;
|
|
148
147
|
readonly "< 2^16": true;
|
|
149
148
|
readonly "< 2^31": true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int16.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"int16.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int16.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIhE,MAAM,MAAM,KAAK,GAAG,iBAAiB,CAAC;AAgCtC;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,uCAAK,CAAC;AAE1B;;;;;;GAMG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;MAAW,CAAC;AAEhC;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK;IAChB;;;;;OAKG;;IAGH;;;;OAIG;;IAGH;;;;OAIG;;IAGH;;;;;OAKG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;OAKG;;IAGH;;;;OAIG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;;;;;;;;;;;;;;;;;CAEK,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type Int32 as TtfImported_Int32 } from 'ts-type-forge';
|
|
2
|
-
import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
3
2
|
export type Int32 = TtfImported_Int32;
|
|
4
3
|
/**
|
|
5
4
|
* Checks if a number is an Int32 (32-bit signed integer in the range [-2^31,
|
|
@@ -62,7 +61,7 @@ export declare const Int32: {
|
|
|
62
61
|
* @param a The Int32 value.
|
|
63
62
|
* @returns The absolute value as an Int32, clamped to valid range.
|
|
64
63
|
*/
|
|
65
|
-
readonly abs: (x: import("ts-type-forge").WithSmallInt<TtfImported_Int32>) =>
|
|
64
|
+
readonly abs: (x: import("ts-type-forge").WithSmallInt<TtfImported_Int32>) => import("ts-type-forge").IntersectBrand<TtfImported_Int32, import("ts-type-forge").NonNegativeNumber>;
|
|
66
65
|
/**
|
|
67
66
|
* Returns the smaller of two Int32 values.
|
|
68
67
|
*
|
|
@@ -135,9 +134,9 @@ export declare const Int32: {
|
|
|
135
134
|
readonly NaNValue: false;
|
|
136
135
|
readonly Finite: true;
|
|
137
136
|
readonly Int: true;
|
|
138
|
-
readonly "!=0": true;
|
|
139
137
|
readonly "> -2^32": true;
|
|
140
138
|
readonly ">= -2^31": true;
|
|
139
|
+
readonly "!=0": true;
|
|
141
140
|
readonly "< 2^31": true;
|
|
142
141
|
readonly "< 2^32": true;
|
|
143
142
|
readonly SafeInt: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int32.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"int32.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/int32.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIhE,MAAM,MAAM,KAAK,GAAG,iBAAiB,CAAC;AAgCtC;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,uCAAK,CAAC;AAE1B;;;;;;GAMG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;MAAW,CAAC;AAEhC;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK;IAChB;;;;;OAKG;;IAGH;;;;OAIG;;IAGH;;;;OAIG;;IAGH;;;;;OAKG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;OAKG;;IAGH;;;;OAIG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;;;;;;;;;;;;;CAEK,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { type NegativeFiniteNumber as TtfImported_NegativeFiniteNumber } from 'ts-type-forge';
|
|
2
|
+
import { TsDataForgeInternals } from '../refined-number-utils.mjs';
|
|
3
|
+
import { PositiveFiniteNumber } from './positive-finite-number.mjs';
|
|
4
|
+
export type NegativeFiniteNumber = TtfImported_NegativeFiniteNumber;
|
|
5
|
+
type ElementType = NegativeFiniteNumber;
|
|
6
|
+
/**
|
|
7
|
+
* Checks if a number is a NegativeFiniteNumber (a finite number `< 0`).
|
|
8
|
+
*
|
|
9
|
+
* @param value The value to check.
|
|
10
|
+
* @returns `true` if the value is a NegativeFiniteNumber, `false` otherwise.
|
|
11
|
+
*/
|
|
12
|
+
export declare const isNegativeFiniteNumber: (a: number) => a is TtfImported_NegativeFiniteNumber;
|
|
13
|
+
/**
|
|
14
|
+
* Casts a number to a NegativeFiniteNumber type.
|
|
15
|
+
*
|
|
16
|
+
* @param value The value to cast.
|
|
17
|
+
* @returns The value as a NegativeFiniteNumber type.
|
|
18
|
+
* @throws {TypeError} If the value is not a negative finite number.
|
|
19
|
+
*/
|
|
20
|
+
export declare const asNegativeFiniteNumber: <N extends number>(x: N) => number & {
|
|
21
|
+
readonly NaNValue: false;
|
|
22
|
+
readonly Finite: true;
|
|
23
|
+
readonly ">=0": false;
|
|
24
|
+
readonly "!=0": true;
|
|
25
|
+
readonly "<=0": true;
|
|
26
|
+
readonly "< 2^15": true;
|
|
27
|
+
readonly "< 2^16": true;
|
|
28
|
+
readonly "< 2^31": true;
|
|
29
|
+
readonly "< 2^32": true;
|
|
30
|
+
} & Readonly<{
|
|
31
|
+
'TSTypeForgeInternals--edd2f9ce-7ca5-45b0-9d1a-bd61b9b5d9c3': unknown;
|
|
32
|
+
}> & N;
|
|
33
|
+
/**
|
|
34
|
+
* Namespace providing type-safe arithmetic operations for negative finite
|
|
35
|
+
* numbers.
|
|
36
|
+
*
|
|
37
|
+
* All operations keep results finite (excluding NaN and Infinity). Operations
|
|
38
|
+
* that stay within the negative finite numbers clamp their results to the valid
|
|
39
|
+
* range, while operations whose result leaves the set (`mul`, `div`, `abs`) are
|
|
40
|
+
* typed to reflect the actual sign of the result.
|
|
41
|
+
*/
|
|
42
|
+
export declare const NegativeFiniteNumber: {
|
|
43
|
+
/**
|
|
44
|
+
* Type guard to check if a value is a NegativeFiniteNumber.
|
|
45
|
+
*
|
|
46
|
+
* @param value The value to check.
|
|
47
|
+
* @returns `true` if the value is a negative finite number, `false`
|
|
48
|
+
* otherwise.
|
|
49
|
+
*/
|
|
50
|
+
readonly is: (a: number) => a is TtfImported_NegativeFiniteNumber;
|
|
51
|
+
/**
|
|
52
|
+
* The maximum value for a negative finite number.
|
|
53
|
+
*
|
|
54
|
+
* @readonly
|
|
55
|
+
*/
|
|
56
|
+
readonly MAX_VALUE: number;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the absolute value of a negative finite number.
|
|
59
|
+
*
|
|
60
|
+
* @param a The negative finite number.
|
|
61
|
+
* @returns The absolute value as a PositiveFiniteNumber.
|
|
62
|
+
*/
|
|
63
|
+
readonly abs: (x: ElementType) => PositiveFiniteNumber;
|
|
64
|
+
/**
|
|
65
|
+
* Returns the smaller of two NegativeFiniteNumber values.
|
|
66
|
+
*
|
|
67
|
+
* @param a The first NegativeFiniteNumber.
|
|
68
|
+
* @param b The second NegativeFiniteNumber.
|
|
69
|
+
* @returns The minimum value as a NegativeFiniteNumber.
|
|
70
|
+
*/
|
|
71
|
+
readonly min: (...values: readonly TtfImported_NegativeFiniteNumber[]) => TtfImported_NegativeFiniteNumber;
|
|
72
|
+
/**
|
|
73
|
+
* Returns the larger of two NegativeFiniteNumber values.
|
|
74
|
+
*
|
|
75
|
+
* @param a The first NegativeFiniteNumber.
|
|
76
|
+
* @param b The second NegativeFiniteNumber.
|
|
77
|
+
* @returns The maximum value as a NegativeFiniteNumber.
|
|
78
|
+
*/
|
|
79
|
+
readonly max: (...values: readonly TtfImported_NegativeFiniteNumber[]) => TtfImported_NegativeFiniteNumber;
|
|
80
|
+
/**
|
|
81
|
+
* Clamps a number to the negative finite range.
|
|
82
|
+
*
|
|
83
|
+
* @param value The number to clamp.
|
|
84
|
+
* @returns The value clamped to `(-∞, 0)` as a NegativeFiniteNumber.
|
|
85
|
+
*/
|
|
86
|
+
readonly clamp: (x: number) => TtfImported_NegativeFiniteNumber;
|
|
87
|
+
/**
|
|
88
|
+
* Rounds down a NegativeFiniteNumber to the nearest integer.
|
|
89
|
+
*
|
|
90
|
+
* @param x The NegativeFiniteNumber to round down.
|
|
91
|
+
* @returns The floor value as a NegativeInt (always `<= -1`).
|
|
92
|
+
*/
|
|
93
|
+
readonly floor: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>;
|
|
94
|
+
/**
|
|
95
|
+
* Rounds up a NegativeFiniteNumber to the nearest integer.
|
|
96
|
+
*
|
|
97
|
+
* @param x The NegativeFiniteNumber to round up.
|
|
98
|
+
* @returns The ceiling value as a NonPositiveInt (can be 0).
|
|
99
|
+
*/
|
|
100
|
+
readonly ceil: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>>;
|
|
101
|
+
/**
|
|
102
|
+
* Rounds a NegativeFiniteNumber to the nearest integer.
|
|
103
|
+
*
|
|
104
|
+
* @param x The NegativeFiniteNumber to round.
|
|
105
|
+
* @returns The rounded value as a NonPositiveInt (can be 0 if x > -0.5).
|
|
106
|
+
*/
|
|
107
|
+
readonly round: (x: ElementType) => TsDataForgeInternals.RefinedNumberUtils.RemoveNonZeroBrandKey<TsDataForgeInternals.RefinedNumberUtils.ToInt<ElementType>>;
|
|
108
|
+
/**
|
|
109
|
+
* Generates a random NegativeFiniteNumber value.
|
|
110
|
+
*
|
|
111
|
+
* @returns A random negative finite number.
|
|
112
|
+
*/
|
|
113
|
+
readonly random: (min?: TtfImported_NegativeFiniteNumber | undefined, max?: TtfImported_NegativeFiniteNumber | undefined) => TtfImported_NegativeFiniteNumber;
|
|
114
|
+
/**
|
|
115
|
+
* Raises a NegativeFiniteNumber to the power of another NegativeFiniteNumber.
|
|
116
|
+
*
|
|
117
|
+
* @param a The base NegativeFiniteNumber.
|
|
118
|
+
* @param b The exponent NegativeFiniteNumber.
|
|
119
|
+
* @returns `a ** b` clamped to `(-∞, 0)` as a NegativeFiniteNumber.
|
|
120
|
+
*/
|
|
121
|
+
readonly pow: (x: TtfImported_NegativeFiniteNumber, y: TtfImported_NegativeFiniteNumber) => TtfImported_NegativeFiniteNumber;
|
|
122
|
+
/**
|
|
123
|
+
* Adds two NegativeFiniteNumber values.
|
|
124
|
+
*
|
|
125
|
+
* @param a The first NegativeFiniteNumber.
|
|
126
|
+
* @param b The second NegativeFiniteNumber.
|
|
127
|
+
* @returns `a + b` as a NegativeFiniteNumber.
|
|
128
|
+
*/
|
|
129
|
+
readonly add: (x: TtfImported_NegativeFiniteNumber, y: TtfImported_NegativeFiniteNumber) => TtfImported_NegativeFiniteNumber;
|
|
130
|
+
/**
|
|
131
|
+
* Subtracts one NegativeFiniteNumber from another.
|
|
132
|
+
*
|
|
133
|
+
* The mathematical result can be positive, so it is clamped to the negative
|
|
134
|
+
* finite range (maximum `-Number.MIN_VALUE`).
|
|
135
|
+
*
|
|
136
|
+
* @param a The minuend NegativeFiniteNumber.
|
|
137
|
+
* @param b The subtrahend NegativeFiniteNumber.
|
|
138
|
+
* @returns `a - b` clamped to `(-∞, 0)` as a NegativeFiniteNumber.
|
|
139
|
+
*/
|
|
140
|
+
readonly sub: (x: TtfImported_NegativeFiniteNumber, y: TtfImported_NegativeFiniteNumber) => TtfImported_NegativeFiniteNumber;
|
|
141
|
+
};
|
|
142
|
+
export {};
|
|
143
|
+
//# sourceMappingURL=negative-finite-number.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negative-finite-number.d.mts","sourceRoot":"","sources":["../../../src/number/branded-types/negative-finite-number.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,IAAI,gCAAgC,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAEpE,KAAK,WAAW,GAAG,oBAAoB,CAAC;AAkExC;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,sDAAK,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;MAAW,CAAC;AAE/C;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;;;OAMG;;IAGH;;;;OAIG;;IAGH;;;;;OAKG;sBA/EW,WAAW,KAAG,oBAAoB;IAkFhD;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;wBA7GA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC;IA+G3D;;;;;OAKG;uBA/GA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAC3D;IA+GC;;;;;OAKG;wBA7GA,WAAW,KACb,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,CAC9D,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAC3D;IA6GC;;;;OAIG;;IAGH;;;;;;OAMG;;IAGH;;;;;;OAMG;;IAGH;;;;;;;;;OASG;;CAEK,CAAC"}
|