ts-data-forge 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/globals.d.mts +41 -0
- package/dist/types.d.mts +2 -0
- package/package.json +10 -11
- package/src/globals.d.mts +41 -0
- package/dist/type.d.mts +0 -27
- package/dist/type.d.mts.map +0 -1
- package/dist/type.mjs +0 -62
- package/dist/type.mjs.map +0 -1
- package/src/type.mts +0 -44
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* eslint-disable import/unambiguous */
|
|
2
|
+
|
|
3
|
+
/// <reference types="ts-type-forge" />
|
|
4
|
+
|
|
5
|
+
type SmallPositiveInt = WithSmallInt<PositiveInt>;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents the type of keys that can be used in a standard JavaScript Map.
|
|
9
|
+
*/
|
|
10
|
+
type MapSetKeyType = Primitive;
|
|
11
|
+
|
|
12
|
+
// https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/length
|
|
13
|
+
// https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/String/length
|
|
14
|
+
// Max array length : 2^32 - 1
|
|
15
|
+
// Max string length : 2^53 - 1
|
|
16
|
+
|
|
17
|
+
declare namespace SizeType {
|
|
18
|
+
type Arr = Uint32;
|
|
19
|
+
type TypedArray = SafeUint;
|
|
20
|
+
type Str = SafeUint;
|
|
21
|
+
|
|
22
|
+
type ArrSearchResult = Arr | -1;
|
|
23
|
+
type TypedArraySearchResult = TypedArray | -1;
|
|
24
|
+
type StrSearchResult = Str | -1;
|
|
25
|
+
|
|
26
|
+
type ArgArr = WithSmallInt<Arr>;
|
|
27
|
+
type ArgTypedArray = WithSmallInt<TypedArray>;
|
|
28
|
+
type ArgStr = WithSmallInt<Str>;
|
|
29
|
+
|
|
30
|
+
type ArgArrWithNegative = WithSmallInt<
|
|
31
|
+
NormalizeBrandUnion<NegativeInt32 | Arr>
|
|
32
|
+
>;
|
|
33
|
+
type ArgTypedArrayWithNegative = WithSmallInt<SafeInt>;
|
|
34
|
+
type ArgStrWithNegative = WithSmallInt<SafeInt>;
|
|
35
|
+
|
|
36
|
+
type ArgArrPositive = WithSmallInt<IntersectBrand<PositiveNumber, Arr>>;
|
|
37
|
+
type ArgTypedArrayPositive = WithSmallInt<
|
|
38
|
+
IntersectBrand<PositiveNumber, TypedArray>
|
|
39
|
+
>;
|
|
40
|
+
type ArgStrPositive = WithSmallInt<IntersectBrand<PositiveNumber, Str>>;
|
|
41
|
+
}
|
package/dist/types.d.mts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-data-forge",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"LICENSE"
|
|
36
36
|
],
|
|
37
37
|
"scripts": {
|
|
38
|
-
"build": "
|
|
39
|
-
"check-all": "
|
|
40
|
-
"check:ext": "
|
|
38
|
+
"build": "tsx ./scripts/cmd/build.mjs",
|
|
39
|
+
"check-all": "tsx ./scripts/cmd/check-all.mjs",
|
|
40
|
+
"check:ext": "tsx ./scripts/cmd/check-ext.mjs",
|
|
41
41
|
"cspell": "cspell \"**\" --gitignore --gitignore-root ./ --no-progress",
|
|
42
|
-
"doc": "
|
|
43
|
-
"fmt": "
|
|
42
|
+
"doc": "tsx ./scripts/cmd/gen-docs.mjs",
|
|
43
|
+
"fmt": "tsx ./scripts/cmd/fmt-diff.mjs",
|
|
44
44
|
"fmt:full": "prettier --write .",
|
|
45
|
-
"gi": "
|
|
45
|
+
"gi": "tsx ./scripts/cmd/gi.mjs",
|
|
46
46
|
"lint": "eslint .",
|
|
47
47
|
"lint:fix": "eslint . --fix",
|
|
48
48
|
"lint:samples": "eslint ./samples",
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
"type-check": "tsc --noEmit",
|
|
61
61
|
"type-check:samples": "tsc --noEmit -p ./samples/tsconfig.json",
|
|
62
62
|
"update-packages": "npx npm-check-updates -u --install always --reject @types/node",
|
|
63
|
-
"z:node-esm": "node --import tsx/esm",
|
|
64
63
|
"z:vitest": "vitest --config ./configs/vitest.config.ts"
|
|
65
64
|
},
|
|
66
65
|
"dependencies": {
|
|
@@ -86,15 +85,15 @@
|
|
|
86
85
|
"@vitest/ui": "^3.2.4",
|
|
87
86
|
"conventional-changelog-conventionalcommits": "^9.0.0",
|
|
88
87
|
"cspell": "^9.1.3",
|
|
89
|
-
"eslint": "^9.
|
|
88
|
+
"eslint": "^9.31.0",
|
|
90
89
|
"eslint-import-resolver-typescript": "3.8.3",
|
|
91
90
|
"eslint-plugin-array-func": "5.0.2",
|
|
92
91
|
"eslint-plugin-functional": "7.1.0",
|
|
93
|
-
"eslint-plugin-import": "2.
|
|
92
|
+
"eslint-plugin-import": "2.32.0",
|
|
94
93
|
"eslint-plugin-prefer-arrow-functions": "3.6.2",
|
|
95
94
|
"eslint-plugin-promise": "7.2.1",
|
|
96
95
|
"eslint-plugin-security": "3.0.1",
|
|
97
|
-
"eslint-plugin-unicorn": "
|
|
96
|
+
"eslint-plugin-unicorn": "59.0.1",
|
|
98
97
|
"eslint-plugin-vitest": "0.5.4",
|
|
99
98
|
"fast-glob": "^3.3.3",
|
|
100
99
|
"immer": "^10.1.1",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* eslint-disable import/unambiguous */
|
|
2
|
+
|
|
3
|
+
/// <reference types="ts-type-forge" />
|
|
4
|
+
|
|
5
|
+
type SmallPositiveInt = WithSmallInt<PositiveInt>;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents the type of keys that can be used in a standard JavaScript Map.
|
|
9
|
+
*/
|
|
10
|
+
type MapSetKeyType = Primitive;
|
|
11
|
+
|
|
12
|
+
// https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/length
|
|
13
|
+
// https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/String/length
|
|
14
|
+
// Max array length : 2^32 - 1
|
|
15
|
+
// Max string length : 2^53 - 1
|
|
16
|
+
|
|
17
|
+
declare namespace SizeType {
|
|
18
|
+
type Arr = Uint32;
|
|
19
|
+
type TypedArray = SafeUint;
|
|
20
|
+
type Str = SafeUint;
|
|
21
|
+
|
|
22
|
+
type ArrSearchResult = Arr | -1;
|
|
23
|
+
type TypedArraySearchResult = TypedArray | -1;
|
|
24
|
+
type StrSearchResult = Str | -1;
|
|
25
|
+
|
|
26
|
+
type ArgArr = WithSmallInt<Arr>;
|
|
27
|
+
type ArgTypedArray = WithSmallInt<TypedArray>;
|
|
28
|
+
type ArgStr = WithSmallInt<Str>;
|
|
29
|
+
|
|
30
|
+
type ArgArrWithNegative = WithSmallInt<
|
|
31
|
+
NormalizeBrandUnion<NegativeInt32 | Arr>
|
|
32
|
+
>;
|
|
33
|
+
type ArgTypedArrayWithNegative = WithSmallInt<SafeInt>;
|
|
34
|
+
type ArgStrWithNegative = WithSmallInt<SafeInt>;
|
|
35
|
+
|
|
36
|
+
type ArgArrPositive = WithSmallInt<IntersectBrand<PositiveNumber, Arr>>;
|
|
37
|
+
type ArgTypedArrayPositive = WithSmallInt<
|
|
38
|
+
IntersectBrand<PositiveNumber, TypedArray>
|
|
39
|
+
>;
|
|
40
|
+
type ArgStrPositive = WithSmallInt<IntersectBrand<PositiveNumber, Str>>;
|
|
41
|
+
}
|
package/dist/type.d.mts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import 'ts-type-forge';
|
|
2
|
-
export * from './index.mjs';
|
|
3
|
-
declare global {
|
|
4
|
-
type SmallPositiveInt = WithSmallInt<PositiveInt>;
|
|
5
|
-
/**
|
|
6
|
-
* Represents the type of keys that can be used in a standard JavaScript Map.
|
|
7
|
-
*/
|
|
8
|
-
type MapSetKeyType = Primitive;
|
|
9
|
-
namespace SizeType {
|
|
10
|
-
type Arr = Uint32;
|
|
11
|
-
type TypedArray = SafeUint;
|
|
12
|
-
type Str = SafeUint;
|
|
13
|
-
type ArrSearchResult = Arr | -1;
|
|
14
|
-
type TypedArraySearchResult = TypedArray | -1;
|
|
15
|
-
type StrSearchResult = Str | -1;
|
|
16
|
-
type ArgArr = WithSmallInt<Arr>;
|
|
17
|
-
type ArgTypedArray = WithSmallInt<TypedArray>;
|
|
18
|
-
type ArgStr = WithSmallInt<Str>;
|
|
19
|
-
type ArgArrWithNegative = WithSmallInt<NormalizeBrandUnion<NegativeInt32 | Arr>>;
|
|
20
|
-
type ArgTypedArrayWithNegative = WithSmallInt<SafeInt>;
|
|
21
|
-
type ArgStrWithNegative = WithSmallInt<SafeInt>;
|
|
22
|
-
type ArgArrPositive = WithSmallInt<IntersectBrand<PositiveNumber, Arr>>;
|
|
23
|
-
type ArgTypedArrayPositive = WithSmallInt<IntersectBrand<PositiveNumber, TypedArray>>;
|
|
24
|
-
type ArgStrPositive = WithSmallInt<IntersectBrand<PositiveNumber, Str>>;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=type.d.mts.map
|
package/dist/type.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.mts","sourceRoot":"","sources":["../src/type.mts"],"names":[],"mappings":"AACA,OAAO,eAAe,CAAC;AAEvB,cAAc,aAAa,CAAC;AAE5B,OAAO,CAAC,MAAM,CAAC;IACb,KAAK,gBAAgB,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IAElD;;OAEG;IACH,KAAK,aAAa,GAAG,SAAS,CAAC;IAO/B,UAAU,QAAQ,CAAC;QACjB,KAAK,GAAG,GAAG,MAAM,CAAC;QAClB,KAAK,UAAU,GAAG,QAAQ,CAAC;QAC3B,KAAK,GAAG,GAAG,QAAQ,CAAC;QAEpB,KAAK,eAAe,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC;QAChC,KAAK,sBAAsB,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC;QAC9C,KAAK,eAAe,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC;QAEhC,KAAK,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAChC,KAAK,aAAa,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;QAC9C,KAAK,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAEhC,KAAK,kBAAkB,GAAG,YAAY,CACpC,mBAAmB,CAAC,aAAa,GAAG,GAAG,CAAC,CACzC,CAAC;QACF,KAAK,yBAAyB,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;QACvD,KAAK,kBAAkB,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;QAEhD,KAAK,cAAc,GAAG,YAAY,CAAC,cAAc,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC;QACxE,KAAK,qBAAqB,GAAG,YAAY,CACvC,cAAc,CAAC,cAAc,EAAE,UAAU,CAAC,CAC3C,CAAC;QACF,KAAK,cAAc,GAAG,YAAY,CAAC,cAAc,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC;KACzE;CACF"}
|
package/dist/type.mjs
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import 'ts-type-forge';
|
|
2
|
-
export { Arr } from './array/array-utils.mjs';
|
|
3
|
-
export { IMapMapped } from './collections/imap-mapped.mjs';
|
|
4
|
-
export { IMap } from './collections/imap.mjs';
|
|
5
|
-
export { ISetMapped } from './collections/iset-mapped.mjs';
|
|
6
|
-
export { ISet } from './collections/iset.mjs';
|
|
7
|
-
export { createQueue } from './collections/queue.mjs';
|
|
8
|
-
export { createStack } from './collections/stack.mjs';
|
|
9
|
-
export { expectType } from './expect-type.mjs';
|
|
10
|
-
export { match } from './functional/match.mjs';
|
|
11
|
-
export { Optional } from './functional/optional.mjs';
|
|
12
|
-
export { pipe } from './functional/pipe.mjs';
|
|
13
|
-
export { Result } from './functional/result.mjs';
|
|
14
|
-
export { hasKey } from './guard/has-key.mjs';
|
|
15
|
-
export { isNonEmptyString } from './guard/is-non-empty-string.mjs';
|
|
16
|
-
export { isNonNullObject } from './guard/is-non-null-object.mjs';
|
|
17
|
-
export { isPrimitive } from './guard/is-primitive.mjs';
|
|
18
|
-
export { isRecord } from './guard/is-record.mjs';
|
|
19
|
-
export { isBigint, isBoolean, isNonNullish, isNotBigint, isNotBoolean, isNotNull, isNotNumber, isNotString, isNotSymbol, isNotUndefined, isNull, isNullish, isNumber, isString, isSymbol, isUndefined } from './guard/is-type.mjs';
|
|
20
|
-
export { keyIsIn } from './guard/key-is-in.mjs';
|
|
21
|
-
export { range } from './iterator/range.mjs';
|
|
22
|
-
export { Json } from './json/json.mjs';
|
|
23
|
-
export { FiniteNumber, asFiniteNumber, isFiniteNumber } from './number/branded-types/finite-number.mjs';
|
|
24
|
-
export { Int, asInt, isInt } from './number/branded-types/int.mjs';
|
|
25
|
-
export { Int16, asInt16, isInt16 } from './number/branded-types/int16.mjs';
|
|
26
|
-
export { Int32, asInt32, isInt32 } from './number/branded-types/int32.mjs';
|
|
27
|
-
export { NonNegativeFiniteNumber, asNonNegativeFiniteNumber, isNonNegativeFiniteNumber } from './number/branded-types/non-negative-finite-number.mjs';
|
|
28
|
-
export { NonNegativeInt16, asNonNegativeInt16, isNonNegativeInt16 } from './number/branded-types/non-negative-int16.mjs';
|
|
29
|
-
export { NonNegativeInt32, asNonNegativeInt32, isNonNegativeInt32 } from './number/branded-types/non-negative-int32.mjs';
|
|
30
|
-
export { NonZeroFiniteNumber, asNonZeroFiniteNumber, isNonZeroFiniteNumber } from './number/branded-types/non-zero-finite-number.mjs';
|
|
31
|
-
export { NonZeroInt, asNonZeroInt, isNonZeroInt } from './number/branded-types/non-zero-int.mjs';
|
|
32
|
-
export { NonZeroInt16, asNonZeroInt16, isNonZeroInt16 } from './number/branded-types/non-zero-int16.mjs';
|
|
33
|
-
export { NonZeroInt32, asNonZeroInt32, isNonZeroInt32 } from './number/branded-types/non-zero-int32.mjs';
|
|
34
|
-
export { NonZeroSafeInt, asNonZeroSafeInt, isNonZeroSafeInt } from './number/branded-types/non-zero-safe-int.mjs';
|
|
35
|
-
export { NonZeroUint16, asNonZeroUint16, isNonZeroUint16 } from './number/branded-types/non-zero-uint16.mjs';
|
|
36
|
-
export { NonZeroUint32, asNonZeroUint32, isNonZeroUint32 } from './number/branded-types/non-zero-uint32.mjs';
|
|
37
|
-
export { PositiveFiniteNumber, asPositiveFiniteNumber, isPositiveFiniteNumber } from './number/branded-types/positive-finite-number.mjs';
|
|
38
|
-
export { PositiveInt, asPositiveInt, isPositiveInt } from './number/branded-types/positive-int.mjs';
|
|
39
|
-
export { PositiveInt16, asPositiveInt16, isPositiveInt16 } from './number/branded-types/positive-int16.mjs';
|
|
40
|
-
export { PositiveInt32, asPositiveInt32, isPositiveInt32 } from './number/branded-types/positive-int32.mjs';
|
|
41
|
-
export { PositiveSafeInt, asPositiveSafeInt, isPositiveSafeInt } from './number/branded-types/positive-safe-int.mjs';
|
|
42
|
-
export { PositiveUint16, asPositiveUint16, isPositiveUint16 } from './number/branded-types/positive-uint16.mjs';
|
|
43
|
-
export { PositiveUint32, asPositiveUint32, isPositiveUint32 } from './number/branded-types/positive-uint32.mjs';
|
|
44
|
-
export { SafeInt, asSafeInt, isSafeInt } from './number/branded-types/safe-int.mjs';
|
|
45
|
-
export { SafeUint, asSafeUint, isSafeUint } from './number/branded-types/safe-uint.mjs';
|
|
46
|
-
export { Uint, asUint, isUint } from './number/branded-types/uint.mjs';
|
|
47
|
-
export { Uint16, asUint16, isUint16 } from './number/branded-types/uint16.mjs';
|
|
48
|
-
export { Uint32, asUint32, isUint32 } from './number/branded-types/uint32.mjs';
|
|
49
|
-
export { Int8, asInt8, isInt8 } from './number/enum/int8.mjs';
|
|
50
|
-
export { Uint8, asUint8, isUint8 } from './number/enum/uint8.mjs';
|
|
51
|
-
export { Num } from './number/num.mjs';
|
|
52
|
-
export { TsDataForgeInternals } from './number/refined-number-utils.mjs';
|
|
53
|
-
export { Obj } from './object/object.mjs';
|
|
54
|
-
export { castDeepMutable, castMutable } from './others/cast-mutable.mjs';
|
|
55
|
-
export { castDeepReadonly, castReadonly } from './others/cast-readonly.mjs';
|
|
56
|
-
export { ifThen } from './others/if-then.mjs';
|
|
57
|
-
export { mapNullable } from './others/map-nullable.mjs';
|
|
58
|
-
export { memoizeFunction } from './others/memoize-function.mjs';
|
|
59
|
-
export { tp } from './others/tuple.mjs';
|
|
60
|
-
export { unknownToString } from './others/unknown-to-string.mjs';
|
|
61
|
-
export { createPromise } from './promise/promise.mjs';
|
|
62
|
-
//# sourceMappingURL=type.mjs.map
|
package/dist/type.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/src/type.mts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-unassigned-import
|
|
2
|
-
import 'ts-type-forge';
|
|
3
|
-
|
|
4
|
-
export * from './index.mjs';
|
|
5
|
-
|
|
6
|
-
declare global {
|
|
7
|
-
type SmallPositiveInt = WithSmallInt<PositiveInt>;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Represents the type of keys that can be used in a standard JavaScript Map.
|
|
11
|
-
*/
|
|
12
|
-
type MapSetKeyType = Primitive;
|
|
13
|
-
|
|
14
|
-
// https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/length
|
|
15
|
-
// https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/String/length
|
|
16
|
-
// Max array length : 2^32 - 1
|
|
17
|
-
// Max string length : 2^53 - 1
|
|
18
|
-
|
|
19
|
-
namespace SizeType {
|
|
20
|
-
type Arr = Uint32;
|
|
21
|
-
type TypedArray = SafeUint;
|
|
22
|
-
type Str = SafeUint;
|
|
23
|
-
|
|
24
|
-
type ArrSearchResult = Arr | -1;
|
|
25
|
-
type TypedArraySearchResult = TypedArray | -1;
|
|
26
|
-
type StrSearchResult = Str | -1;
|
|
27
|
-
|
|
28
|
-
type ArgArr = WithSmallInt<Arr>;
|
|
29
|
-
type ArgTypedArray = WithSmallInt<TypedArray>;
|
|
30
|
-
type ArgStr = WithSmallInt<Str>;
|
|
31
|
-
|
|
32
|
-
type ArgArrWithNegative = WithSmallInt<
|
|
33
|
-
NormalizeBrandUnion<NegativeInt32 | Arr>
|
|
34
|
-
>;
|
|
35
|
-
type ArgTypedArrayWithNegative = WithSmallInt<SafeInt>;
|
|
36
|
-
type ArgStrWithNegative = WithSmallInt<SafeInt>;
|
|
37
|
-
|
|
38
|
-
type ArgArrPositive = WithSmallInt<IntersectBrand<PositiveNumber, Arr>>;
|
|
39
|
-
type ArgTypedArrayPositive = WithSmallInt<
|
|
40
|
-
IntersectBrand<PositiveNumber, TypedArray>
|
|
41
|
-
>;
|
|
42
|
-
type ArgStrPositive = WithSmallInt<IntersectBrand<PositiveNumber, Str>>;
|
|
43
|
-
}
|
|
44
|
-
}
|