@duplojs/lang 0.0.1-beta.6 → 0.0.1-beta.8
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/chrono/createDate.cjs +8 -8
- package/dist/chrono/createDate.d.ts +3 -3
- package/dist/chrono/createDate.mjs +8 -8
- package/dist/chrono/createTime.cjs +24 -13
- package/dist/chrono/createTime.mjs +24 -13
- package/dist/chrono/theDate.cjs +15 -16
- package/dist/chrono/theDate.d.ts +15 -15
- package/dist/chrono/theDate.mjs +15 -16
- package/dist/chrono/theTime.cjs +0 -1
- package/dist/chrono/theTime.mjs +0 -1
- package/dist/chrono/types/spoolingTime.d.ts +2 -1
- package/dist/common/constraint/cast/string.d.ts +4 -0
- package/dist/common/constraint/infer/string.d.ts +1 -0
- package/dist/common/isType.d.ts +3 -2
- package/dist/common/types/json.d.ts +1 -1
- package/dist/dataStructure/common/{codec.cjs → codec/base.cjs} +5 -5
- package/dist/dataStructure/common/{codec.d.ts → codec/base.d.ts} +6 -6
- package/dist/dataStructure/common/{codec.mjs → codec/base.mjs} +5 -5
- package/dist/dataStructure/common/codec/defaults/index.d.ts +2 -0
- package/dist/dataStructure/common/codec/defaults/json.cjs +26 -0
- package/dist/dataStructure/common/codec/defaults/json.d.ts +6 -0
- package/dist/dataStructure/common/codec/defaults/json.mjs +26 -0
- package/dist/dataStructure/common/codec/defaults/string.cjs +44 -0
- package/dist/dataStructure/common/codec/defaults/string.d.ts +11 -0
- package/dist/dataStructure/common/codec/defaults/string.mjs +44 -0
- package/dist/dataStructure/common/codec/index.d.ts +2 -0
- package/dist/dataStructure/constraint/base.cjs +18 -2
- package/dist/dataStructure/constraint/base.d.ts +5 -0
- package/dist/dataStructure/constraint/base.mjs +18 -3
- package/dist/dataStructure/constraint/defaults/index.d.ts +1 -0
- package/dist/dataStructure/constraint/defaults/numberInString.cjs +13 -0
- package/dist/dataStructure/constraint/defaults/numberInString.d.ts +10 -0
- package/dist/dataStructure/constraint/defaults/numberInString.mjs +12 -0
- package/dist/dataStructure/constraint/types/constraints.d.ts +1 -0
- package/dist/dataStructure/helpers/index.d.ts +1 -0
- package/dist/dataStructure/helpers/numberInString.cjs +7 -0
- package/dist/dataStructure/helpers/numberInString.d.ts +2 -0
- package/dist/dataStructure/helpers/numberInString.mjs +7 -0
- package/dist/dataStructure/index.cjs +65 -49
- package/dist/dataStructure/index.mjs +23 -13
- package/dist/modeling/entity/base.d.ts +2 -2
- package/dist/modeling/taggedObject/base.cjs +64 -1
- package/dist/modeling/taggedObject/base.d.ts +19 -1
- package/dist/modeling/taggedObject/base.mjs +64 -1
- package/dist/number/types/isGreater.d.ts +5 -5
- package/dist/path/getParentFolderPath.cjs +6 -2
- package/dist/path/getParentFolderPath.d.ts +1 -1
- package/dist/path/getParentFolderPath.mjs +6 -2
- package/dist/string/constraints/index.d.ts +2 -1
- package/dist/string/constraints/number.d.ts +4 -0
- package/dist/string/index.cjs +3 -0
- package/dist/string/index.d.ts +1 -0
- package/dist/string/index.mjs +3 -1
- package/dist/string/isNumber.cjs +7 -0
- package/dist/string/isNumber.d.ts +5 -0
- package/dist/string/isNumber.mjs +7 -0
- package/dist/string/to.d.ts +9 -2
- package/dist/string/types/index.d.ts +4 -5
- package/dist/string/types/numberInString.d.ts +1 -0
- package/package.json +1 -1
- package/dist/string/types/number.d.ts +0 -1
|
@@ -25,13 +25,13 @@ type CheckIsGreater<GreaterSplitValue extends DCommon.AnyTuple<DString.Digit>, G
|
|
|
25
25
|
infer InferredRestSplitValue extends DCommon.AnyTuple<DString.Digit>,
|
|
26
26
|
infer InferredRestSplitReference extends DCommon.AnyTuple<FigureGreaterThanTableValue>
|
|
27
27
|
] ? CheckIsGreater<InferredRestSplitValue, InferredRestSplitReference> : never : false;
|
|
28
|
-
type toStringDecimal<GenericValue extends number> = `${GenericValue}` extends `${DString.
|
|
28
|
+
type toStringDecimal<GenericValue extends number> = `${GenericValue}` extends `${DString.NumberInString}.${DString.NumberInString}` ? `${GenericValue}` : `${GenericValue}.0`;
|
|
29
29
|
type PrepareValues<GenericValue extends number, GenericReference extends number> = readonly [
|
|
30
30
|
toStringDecimal<GenericValue>,
|
|
31
31
|
toStringDecimal<GenericReference>
|
|
32
32
|
] extends readonly [
|
|
33
|
-
`${infer InferredValueInteger extends DString.
|
|
34
|
-
`${infer InferredReferenceInteger extends DString.
|
|
33
|
+
`${infer InferredValueInteger extends DString.NumberInString}.${infer InferredValueDecimals extends DString.NumberInString}`,
|
|
34
|
+
`${infer InferredReferenceInteger extends DString.NumberInString}.${infer InferredReferenceDecimals extends DString.NumberInString}`
|
|
35
35
|
] ? DCommon.And<[
|
|
36
36
|
DCommon.IsEqual<InferredValueDecimals, "0">,
|
|
37
37
|
DCommon.IsEqual<InferredReferenceDecimals, "0">
|
|
@@ -52,8 +52,8 @@ type PrepareValues<GenericValue extends number, GenericReference extends number>
|
|
|
52
52
|
`${infer InferredResultReference}`
|
|
53
53
|
] ? readonly [`${InferredResultValue}`, `${InferredResultReference}`] : never : never : readonly [InferredValueInteger, InferredReferenceInteger] : never;
|
|
54
54
|
type ComputeIsGreater<GenericValue extends number, GenericReference extends number> = PrepareValues<GenericValue, GenericReference> extends readonly [
|
|
55
|
-
infer InferredValue extends DString.
|
|
56
|
-
infer InferredReference extends DString.
|
|
55
|
+
infer InferredValue extends DString.NumberInString,
|
|
56
|
+
infer InferredReference extends DString.NumberInString
|
|
57
57
|
] ? DCommon.And<[
|
|
58
58
|
DString.Includes<InferredValue, "-">,
|
|
59
59
|
DCommon.Not<DString.Includes<InferredReference, "-">>
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
//#region scripts/path/getParentFolderPath.ts
|
|
2
2
|
const parentFolderPathRegex = /^([^]*)\/[^/]+$/;
|
|
3
|
-
const
|
|
3
|
+
const onlyParentSegmentsRegex = /^(?:\.\.)(?:\/\.\.)*$/;
|
|
4
4
|
function getParentFolderPath(path) {
|
|
5
|
+
if (path === "/") return null;
|
|
6
|
+
if (path === ".") return "..";
|
|
7
|
+
if (onlyParentSegmentsRegex.test(path)) return `${path}/..`;
|
|
5
8
|
const parent = parentFolderPathRegex.exec(path)?.[1];
|
|
6
|
-
if (parent === void 0
|
|
9
|
+
if (parent === void 0) return ".";
|
|
10
|
+
if (parent === "") return "/";
|
|
7
11
|
return parent;
|
|
8
12
|
}
|
|
9
13
|
//#endregion
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Absolute, Path } from './constraints';
|
|
2
|
-
export declare function getParentFolderPath<GenericPath extends string & (Path | Absolute)>(path: GenericPath): string | null;
|
|
2
|
+
export declare function getParentFolderPath<GenericPath extends string & (Path | Absolute)>(path: GenericPath): (string & Path) | null;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
//#region scripts/path/getParentFolderPath.ts
|
|
2
2
|
const parentFolderPathRegex = /^([^]*)\/[^/]+$/;
|
|
3
|
-
const
|
|
3
|
+
const onlyParentSegmentsRegex = /^(?:\.\.)(?:\/\.\.)*$/;
|
|
4
4
|
function getParentFolderPath(path) {
|
|
5
|
+
if (path === "/") return null;
|
|
6
|
+
if (path === ".") return "..";
|
|
7
|
+
if (onlyParentSegmentsRegex.test(path)) return `${path}/..`;
|
|
5
8
|
const parent = parentFolderPathRegex.exec(path)?.[1];
|
|
6
|
-
if (parent === void 0
|
|
9
|
+
if (parent === void 0) return ".";
|
|
10
|
+
if (parent === "") return "/";
|
|
7
11
|
return parent;
|
|
8
12
|
}
|
|
9
13
|
//#endregion
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export type * from './types';
|
|
2
1
|
export type * from './allowedCharacters';
|
|
3
2
|
export type * from './email';
|
|
4
3
|
export type * from './format';
|
|
@@ -6,6 +5,8 @@ export type * from './lengthEqual';
|
|
|
6
5
|
export type * from './maxCharacters';
|
|
7
6
|
export type * from './minCharacters';
|
|
8
7
|
export type * from './notEmpty';
|
|
8
|
+
export type * from './number';
|
|
9
9
|
export type * from './trimmed';
|
|
10
|
+
export type * from './types';
|
|
10
11
|
export type * from './url';
|
|
11
12
|
export type * from './uuid';
|
package/dist/string/index.cjs
CHANGED
|
@@ -14,6 +14,7 @@ const require_isEmail = require("./isEmail.cjs");
|
|
|
14
14
|
const require_isIn = require("./isIn.cjs");
|
|
15
15
|
const require_isKeyof = require("./isKeyof.cjs");
|
|
16
16
|
const require_isNotEmpty = require("./isNotEmpty.cjs");
|
|
17
|
+
const require_isNumber = require("./isNumber.cjs");
|
|
17
18
|
const require_isUrl = require("./isUrl.cjs");
|
|
18
19
|
const require_isUuid = require("./isUuid.cjs");
|
|
19
20
|
const require_join = require("./join.cjs");
|
|
@@ -67,6 +68,7 @@ var string_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
|
67
68
|
isIn: () => require_isIn.isIn,
|
|
68
69
|
isKeyof: () => require_isKeyof.isKeyof,
|
|
69
70
|
isNotEmpty: () => require_isNotEmpty.isNotEmpty,
|
|
71
|
+
isNumber: () => require_isNumber.isNumber,
|
|
70
72
|
isTrimmed: () => require_is.isTrimmed,
|
|
71
73
|
isUrl: () => require_isUrl.isUrl,
|
|
72
74
|
isUuid: () => require_isUuid.isUuid,
|
|
@@ -121,6 +123,7 @@ exports.isEmail = require_isEmail.isEmail;
|
|
|
121
123
|
exports.isIn = require_isIn.isIn;
|
|
122
124
|
exports.isKeyof = require_isKeyof.isKeyof;
|
|
123
125
|
exports.isNotEmpty = require_isNotEmpty.isNotEmpty;
|
|
126
|
+
exports.isNumber = require_isNumber.isNumber;
|
|
124
127
|
exports.isTrimmed = require_is.isTrimmed;
|
|
125
128
|
exports.isUrl = require_isUrl.isUrl;
|
|
126
129
|
exports.isUuid = require_isUuid.isUuid;
|
package/dist/string/index.d.ts
CHANGED
package/dist/string/index.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import { emailRegex, isEmail } from "./isEmail.mjs";
|
|
|
14
14
|
import { isIn } from "./isIn.mjs";
|
|
15
15
|
import { isKeyof } from "./isKeyof.mjs";
|
|
16
16
|
import { isNotEmpty } from "./isNotEmpty.mjs";
|
|
17
|
+
import { isNumber } from "./isNumber.mjs";
|
|
17
18
|
import { isUrl } from "./isUrl.mjs";
|
|
18
19
|
import { isUuid, uuidRegex } from "./isUuid.mjs";
|
|
19
20
|
import { join } from "./join.mjs";
|
|
@@ -67,6 +68,7 @@ var string_exports = /* @__PURE__ */ __exportAll({
|
|
|
67
68
|
isIn: () => isIn,
|
|
68
69
|
isKeyof: () => isKeyof,
|
|
69
70
|
isNotEmpty: () => isNotEmpty,
|
|
71
|
+
isNumber: () => isNumber,
|
|
70
72
|
isTrimmed: () => isTrimmed,
|
|
71
73
|
isUrl: () => isUrl,
|
|
72
74
|
isUuid: () => isUuid,
|
|
@@ -105,4 +107,4 @@ var string_exports = /* @__PURE__ */ __exportAll({
|
|
|
105
107
|
uuidRegex: () => uuidRegex
|
|
106
108
|
});
|
|
107
109
|
//#endregion
|
|
108
|
-
export { at, capitalize, charAt, concat, emailRegex, endsWith, extract, extractAll, first, includes, indexOf, isComposedOf, isEmail, isIn, isKeyof, isNotEmpty, isTrimmed, isUrl, isUuid, join, last, lastIndexOf, length, lengthEqual, maxCharacters, minCharacters, normalize, padEnd, padStart, pop, prepend, repeat, replace, replaceAll, search, shift, slice, sort, sortCompare, split, startsWith, string_exports, stringify, substring, test, to, toLowerCase, toUpperCase, trim, trimEnd, trimStart, uncapitalize, uuidRegex };
|
|
110
|
+
export { at, capitalize, charAt, concat, emailRegex, endsWith, extract, extractAll, first, includes, indexOf, isComposedOf, isEmail, isIn, isKeyof, isNotEmpty, isNumber, isTrimmed, isUrl, isUuid, join, last, lastIndexOf, length, lengthEqual, maxCharacters, minCharacters, normalize, padEnd, padStart, pop, prepend, repeat, replace, replaceAll, search, shift, slice, sort, sortCompare, split, startsWith, string_exports, stringify, substring, test, to, toLowerCase, toUpperCase, trim, trimEnd, trimStart, uncapitalize, uuidRegex };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Number } from './constraints';
|
|
2
|
+
import { NumberInString } from './types';
|
|
3
|
+
type ComputeResult<GenericValue extends string> = GenericValue extends Number ? GenericValue : GenericValue extends NumberInString ? GenericValue : GenericValue & Number;
|
|
4
|
+
export declare function isNumber<GenericValue extends string>(string: GenericValue): string is ComputeResult<GenericValue>;
|
|
5
|
+
export {};
|
package/dist/string/to.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Number } from './constraints';
|
|
2
|
+
import type * as DNumber from '../number';
|
|
3
|
+
type Stringifyable = (null | undefined | {
|
|
4
|
+
toString(): string;
|
|
5
|
+
});
|
|
6
|
+
type ComputeResult<GenericValue extends Stringifyable> = GenericValue extends number ? DNumber.IsLiteral<GenericValue> extends true ? `${GenericValue}` : string & Number : GenericValue extends (string | boolean | null | undefined | bigint) ? `${GenericValue}` : GenericValue extends {
|
|
7
|
+
toString(): string;
|
|
8
|
+
} ? ReturnType<GenericValue["toString"]> : never;
|
|
9
|
+
export declare function to<GenericValue extends Stringifyable>(value: GenericValue): ComputeResult<GenericValue>;
|
|
3
10
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type * from './at';
|
|
1
2
|
export type * from './countMinCharacters';
|
|
2
3
|
export type * from './digit';
|
|
3
4
|
export type * from './endsWith';
|
|
@@ -5,12 +6,14 @@ export type * from './first';
|
|
|
5
6
|
export type * from './forbiddenContain';
|
|
6
7
|
export type * from './forbiddenString';
|
|
7
8
|
export type * from './includes';
|
|
9
|
+
export type * from './isKeyPattern';
|
|
8
10
|
export type * from './isLiteral';
|
|
11
|
+
export type * from './isTemplateLiteral';
|
|
9
12
|
export type * from './join';
|
|
10
13
|
export type * from './last';
|
|
11
14
|
export type * from './length';
|
|
12
15
|
export type * from './normalizeForm';
|
|
13
|
-
export type * from './
|
|
16
|
+
export type * from './numberInString';
|
|
14
17
|
export type * from './pop';
|
|
15
18
|
export type * from './replace';
|
|
16
19
|
export type * from './requireLiteral';
|
|
@@ -18,7 +21,3 @@ export type * from './requireSimpleLiteral';
|
|
|
18
21
|
export type * from './shift';
|
|
19
22
|
export type * from './split';
|
|
20
23
|
export type * from './startsWith';
|
|
21
|
-
export type * from './isKeyPattern';
|
|
22
|
-
export type * from './at';
|
|
23
|
-
export type * from './first';
|
|
24
|
-
export type * from './last';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type NumberInString = `${number}`;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Number = `${number}`;
|