@candlerip/shared3 0.0.48 → 0.0.49
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +11 -9
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/translation/index.d.ts +1 -0
- package/src/translation/index.js +1 -0
- package/src/translation/language/configs/index.d.ts +1 -0
- package/src/translation/language/configs/index.js +1 -0
- package/src/translation/language/domains/index.d.ts +2 -0
- package/src/translation/language/index.d.ts +4 -0
- package/src/translation/language/index.js +4 -0
- package/src/translation/language/type-guards/index.d.ts +1 -0
- package/src/translation/language/type-guards/index.js +1 -0
- package/src/translation/language/type-guards/is-language/index.d.ts +2 -0
- package/src/translation/language/type-guards/is-language/index.js +4 -0
- package/src/translation/language/validates/index.d.ts +1 -0
- package/src/translation/language/validates/index.js +1 -0
- package/src/translation/language/validates/validate-language/index.d.ts +2 -0
- package/src/translation/language/validates/validate-language/index.js +3 -0
- package/src/translation/language/validates/validate-language/types.d.ts +7 -0
- package/src/translation/language/validates/validate-language/types.js +1 -0
- package/src/type/index.d.ts +2 -1
- package/src/type/index.js +2 -1
- package/src/type/string/index.d.ts +1 -0
- package/src/type/string/index.js +1 -0
- package/src/type/string/type-guards/index.d.ts +1 -0
- package/src/type/string/type-guards/index.js +1 -0
- package/src/type/type/index.d.ts +1 -0
- package/src/type/type/index.js +1 -0
- package/src/type/type/utils/index.d.ts +1 -0
- package/src/type/type/utils/index.js +1 -0
- package/src/type/type/utils/validate-type/index.d.ts +6 -0
- package/src/type/type/utils/validate-type/index.js +18 -0
- package/src/type/type-guards/index.d.ts +1 -7
- package/src/type/type-guards/index.js +1 -7
- package/src/type/type-map/domains/index.js +1 -0
- package/src/type/type-map/index.d.ts +1 -0
- package/src/type/type-map/index.js +1 -0
- package/src/type/type-guards/is-array/index.d.ts +0 -1
- package/src/type/type-guards/is-array/index.js +0 -9
- package/src/type/type-guards/is-boolean/index.d.ts +0 -1
- package/src/type/type-guards/is-boolean/index.js +0 -1
- package/src/type/type-guards/is-null/index.d.ts +0 -1
- package/src/type/type-guards/is-null/index.js +0 -1
- package/src/type/type-guards/is-number/index.d.ts +0 -1
- package/src/type/type-guards/is-number/index.js +0 -1
- package/src/type/type-guards/is-object/index.d.ts +0 -3
- package/src/type/type-guards/is-object/index.js +0 -3
- package/src/type/type-guards/is-object/object/index.d.ts +0 -1
- package/src/type/type-guards/is-object/object/index.js +0 -11
- package/src/type/type-guards/is-object/properties-in-object/index.d.ts +0 -1
- package/src/type/type-guards/is-object/properties-in-object/index.js +0 -8
- package/src/type/type-guards/is-object/property-in-object/index.d.ts +0 -1
- package/src/type/type-guards/is-object/property-in-object/index.js +0 -13
- package/src/type/type-guards/is-undefined/index.d.ts +0 -1
- package/src/type/type-guards/is-undefined/index.js +0 -1
- /package/src/{type → translation/language}/domains/index.js +0 -0
- /package/src/type/{type-guards → string/type-guards}/is-string/index.d.ts +0 -0
- /package/src/type/{type-guards → string/type-guards}/is-string/index.js +0 -0
- /package/src/type/{domains → type-map/domains}/index.d.ts +0 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@candlerip/shared3",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.49",
|
4
4
|
"type": "module",
|
5
5
|
"main": "src/index.js",
|
6
6
|
"bin": {
|
@@ -20,14 +20,16 @@
|
|
20
20
|
"pub": "./devops/publish.sh",
|
21
21
|
"start": "./_devops/typescript/tsc-watch.sh"
|
22
22
|
},
|
23
|
-
"
|
24
|
-
"@types/node": "^22.
|
25
|
-
"
|
26
|
-
"
|
27
|
-
"
|
28
|
-
"prettier": "^3.3.2",
|
23
|
+
"devDependencies": {
|
24
|
+
"@types/node": "^22.7.4",
|
25
|
+
"eslint": "^9.12.0",
|
26
|
+
"globals": "^15.10.0",
|
27
|
+
"prettier": "^3.3.3",
|
29
28
|
"tsc-alias": "^1.8.10",
|
30
|
-
"typescript": "^5.
|
31
|
-
"typescript-eslint": "^
|
29
|
+
"typescript": "^5.6.2",
|
30
|
+
"typescript-eslint": "^8.8.0"
|
31
|
+
},
|
32
|
+
"dependencies": {
|
33
|
+
"dotenv": "^16.4.5"
|
32
34
|
}
|
33
35
|
}
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './language/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './language/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const LANGUAGES: readonly ["en", "hu"];
|
@@ -0,0 +1 @@
|
|
1
|
+
export const LANGUAGES = ['en', 'hu'];
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './is-language/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './is-language/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './validate-language/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './validate-language/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/src/type/index.d.ts
CHANGED
package/src/type/index.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './type-guards/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './type-guards/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './is-string/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './is-string/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './utils/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './utils/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './validate-type/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './validate-type/index.js';
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { customErrorWorker } from '../../../../error/index.js';
|
2
|
+
import { isString } from '../../../index.js';
|
3
|
+
export const validateType = (data, name, valids) => {
|
4
|
+
const _customErrorWorker = customErrorWorker();
|
5
|
+
_customErrorWorker.addInfo({ data, name, valids });
|
6
|
+
if (!data) {
|
7
|
+
return _customErrorWorker.composeCustomError(`Missing ${name}`);
|
8
|
+
}
|
9
|
+
if (!isString(data)) {
|
10
|
+
return _customErrorWorker.composeCustomError(`Invalid ${name}`);
|
11
|
+
}
|
12
|
+
if (!valids.includes(data)) {
|
13
|
+
return _customErrorWorker.composeCustomError(`Invalid ${name}`);
|
14
|
+
}
|
15
|
+
return {
|
16
|
+
data: data,
|
17
|
+
};
|
18
|
+
};
|
@@ -1,8 +1,2 @@
|
|
1
|
-
export * from '
|
2
|
-
export * from './is-boolean/index.js';
|
3
|
-
export * from './is-null/index.js';
|
4
|
-
export * from './is-number/index.js';
|
5
|
-
export * from './is-object/index.js';
|
6
|
-
export * from './is-string/index.js';
|
1
|
+
export * from '../string/type-guards/is-string/index.js';
|
7
2
|
export * from './is-type/index.js';
|
8
|
-
export * from './is-undefined/index.js';
|
@@ -1,8 +1,2 @@
|
|
1
|
-
export * from '
|
2
|
-
export * from './is-boolean/index.js';
|
3
|
-
export * from './is-null/index.js';
|
4
|
-
export * from './is-number/index.js';
|
5
|
-
export * from './is-object/index.js';
|
6
|
-
export * from './is-string/index.js';
|
1
|
+
export * from '../string/type-guards/is-string/index.js';
|
7
2
|
export * from './is-type/index.js';
|
8
|
-
export * from './is-undefined/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './domains/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './domains/index.js';
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const isArray: <T>(data?: unknown, typeGuard?: (data?: unknown) => data is T) => data is T[];
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const isBoolean: (data?: unknown) => data is boolean;
|
@@ -1 +0,0 @@
|
|
1
|
-
export const isBoolean = (data) => typeof data === 'boolean';
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const isNull: (data?: unknown) => data is null;
|
@@ -1 +0,0 @@
|
|
1
|
-
export const isNull = (data) => data === null;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const isNumber: (data?: unknown) => data is number;
|
@@ -1 +0,0 @@
|
|
1
|
-
export const isNumber = (data) => typeof data === 'number';
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const isObject: (data?: unknown) => data is Record<string, unknown>;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { isArray } from '../../is-array/index.js';
|
2
|
-
import { isNull } from '../../is-null/index.js';
|
3
|
-
export const isObject = (data) => {
|
4
|
-
if (typeof data !== 'object') {
|
5
|
-
return false;
|
6
|
-
}
|
7
|
-
if (isNull(data)) {
|
8
|
-
return false;
|
9
|
-
}
|
10
|
-
return !isArray(data);
|
11
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const isPropertiesInObject: <X extends string, T>(props: X[], data?: unknown, typeGuard?: (data?: unknown) => data is T) => data is { [key in X]: T; };
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { isObject } from '../object/index.js';
|
2
|
-
import { isPropertyInObject } from '../property-in-object/index.js';
|
3
|
-
export const isPropertiesInObject = (props, data, typeGuard) => {
|
4
|
-
if (!isObject(data)) {
|
5
|
-
return false;
|
6
|
-
}
|
7
|
-
return props.every((a) => isPropertyInObject(a, data, typeGuard));
|
8
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const isPropertyInObject: <X extends string, T>(prop: X, data?: unknown, typeGuard?: (data?: unknown) => data is T) => data is Record<X, T>;
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { isObject } from '../object/index.js';
|
2
|
-
export const isPropertyInObject = (prop, data, typeGuard) => {
|
3
|
-
if (!isObject(data)) {
|
4
|
-
return false;
|
5
|
-
}
|
6
|
-
if (!(prop in data)) {
|
7
|
-
return false;
|
8
|
-
}
|
9
|
-
if (typeGuard && !typeGuard(data[prop])) {
|
10
|
-
return false;
|
11
|
-
}
|
12
|
-
return true;
|
13
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const isUndefined: (data?: unknown) => data is undefined;
|
@@ -1 +0,0 @@
|
|
1
|
-
export const isUndefined = (data) => data === undefined;
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|