@candlerip/shared3 0.0.48 → 0.0.50

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/package.json +11 -9
  2. package/src/index.d.ts +1 -0
  3. package/src/index.js +1 -0
  4. package/src/translation/index.d.ts +1 -0
  5. package/src/translation/index.js +1 -0
  6. package/src/translation/language/configs/index.d.ts +1 -0
  7. package/src/translation/language/configs/index.js +1 -0
  8. package/src/translation/language/domains/index.d.ts +2 -0
  9. package/src/translation/language/index.d.ts +4 -0
  10. package/src/translation/language/index.js +4 -0
  11. package/src/translation/language/type-guards/index.d.ts +1 -0
  12. package/src/translation/language/type-guards/index.js +1 -0
  13. package/src/translation/language/type-guards/is-language/index.d.ts +2 -0
  14. package/src/translation/language/type-guards/is-language/index.js +4 -0
  15. package/src/translation/language/validates/index.d.ts +1 -0
  16. package/src/translation/language/validates/index.js +1 -0
  17. package/src/translation/language/validates/validate-language/index.d.ts +2 -0
  18. package/src/translation/language/validates/validate-language/index.js +3 -0
  19. package/src/translation/language/validates/validate-language/types.d.ts +7 -0
  20. package/src/translation/language/validates/validate-language/types.js +1 -0
  21. package/src/type/array/index.d.ts +1 -0
  22. package/src/type/array/index.js +1 -0
  23. package/src/type/array/type-guards/index.d.ts +1 -0
  24. package/src/type/array/type-guards/index.js +1 -0
  25. package/src/type/index.d.ts +4 -1
  26. package/src/type/index.js +4 -1
  27. package/src/type/string/index.d.ts +1 -0
  28. package/src/type/string/index.js +1 -0
  29. package/src/type/string/type-guards/index.d.ts +1 -0
  30. package/src/type/string/type-guards/index.js +1 -0
  31. package/src/type/type/index.d.ts +1 -0
  32. package/src/type/type/index.js +1 -0
  33. package/src/type/type/utils/index.d.ts +1 -0
  34. package/src/type/type/utils/index.js +1 -0
  35. package/src/type/type/utils/validate-type/index.d.ts +6 -0
  36. package/src/type/type/utils/validate-type/index.js +18 -0
  37. package/src/type/type-guards/index.d.ts +1 -7
  38. package/src/type/type-guards/index.js +1 -7
  39. package/src/type/type-map/domains/index.js +1 -0
  40. package/src/type/type-map/index.d.ts +1 -0
  41. package/src/type/type-map/index.js +1 -0
  42. package/src/type/type-guards/is-boolean/index.d.ts +0 -1
  43. package/src/type/type-guards/is-boolean/index.js +0 -1
  44. package/src/type/type-guards/is-null/index.d.ts +0 -1
  45. package/src/type/type-guards/is-null/index.js +0 -1
  46. package/src/type/type-guards/is-number/index.d.ts +0 -1
  47. package/src/type/type-guards/is-number/index.js +0 -1
  48. package/src/type/type-guards/is-object/index.d.ts +0 -3
  49. package/src/type/type-guards/is-object/index.js +0 -3
  50. package/src/type/type-guards/is-object/object/index.d.ts +0 -1
  51. package/src/type/type-guards/is-object/object/index.js +0 -11
  52. package/src/type/type-guards/is-object/properties-in-object/index.d.ts +0 -1
  53. package/src/type/type-guards/is-object/properties-in-object/index.js +0 -8
  54. package/src/type/type-guards/is-object/property-in-object/index.d.ts +0 -1
  55. package/src/type/type-guards/is-object/property-in-object/index.js +0 -13
  56. package/src/type/type-guards/is-undefined/index.d.ts +0 -1
  57. package/src/type/type-guards/is-undefined/index.js +0 -1
  58. /package/src/{type → translation/language}/domains/index.js +0 -0
  59. /package/src/type/{type-guards → array/type-guards}/is-array/index.d.ts +0 -0
  60. /package/src/type/{type-guards → array/type-guards}/is-array/index.js +0 -0
  61. /package/src/type/{type-guards → string/type-guards}/is-string/index.d.ts +0 -0
  62. /package/src/type/{type-guards → string/type-guards}/is-string/index.js +0 -0
  63. /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.48",
3
+ "version": "0.0.50",
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
- "dependencies": {
24
- "@types/node": "^22.5.5",
25
- "dotenv": "^16.4.5",
26
- "eslint": "^8.57.0",
27
- "globals": "^15.9.0",
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.5.2",
31
- "typescript-eslint": "^7.13.1"
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
@@ -4,4 +4,5 @@ export * from './environment/index.js';
4
4
  export * from './error/index.js';
5
5
  export * from './helper/index.js';
6
6
  export * from './project/index.js';
7
+ export * from './translation/index.js';
7
8
  export * from './type/index.js';
package/src/index.js CHANGED
@@ -4,4 +4,5 @@ export * from './environment/index.js';
4
4
  export * from './error/index.js';
5
5
  export * from './helper/index.js';
6
6
  export * from './project/index.js';
7
+ export * from './translation/index.js';
7
8
  export * from './type/index.js';
@@ -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,2 @@
1
+ import { LANGUAGES } from '../configs/index.js';
2
+ export type Language = (typeof LANGUAGES)[number];
@@ -0,0 +1,4 @@
1
+ export * from './configs/index.js';
2
+ export * from './domains/index.js';
3
+ export * from './validates/validate-language/index.js';
4
+ export * from './type-guards/index.js';
@@ -0,0 +1,4 @@
1
+ export * from './configs/index.js';
2
+ export * from './domains/index.js';
3
+ export * from './validates/validate-language/index.js';
4
+ export * from './type-guards/index.js';
@@ -0,0 +1 @@
1
+ export * from './is-language/index.js';
@@ -0,0 +1 @@
1
+ export * from './is-language/index.js';
@@ -0,0 +1,2 @@
1
+ import { Language } from '../../domains/index.js';
2
+ export declare const isLanguage: (data?: unknown) => data is Language;
@@ -0,0 +1,4 @@
1
+ import { LANGUAGES } from '../../configs/index.js';
2
+ export const isLanguage = (data) => {
3
+ return LANGUAGES.some((it) => data === it);
4
+ };
@@ -0,0 +1 @@
1
+ export * from './validate-language/index.js';
@@ -0,0 +1 @@
1
+ export * from './validate-language/index.js';
@@ -0,0 +1,2 @@
1
+ import { ValidateLanguage } from './types.js';
2
+ export declare const validateLanguage: ValidateLanguage;
@@ -0,0 +1,3 @@
1
+ import { validateType } from '../../../../type/type/index.js';
2
+ import { LANGUAGES } from '../../configs/index.js';
3
+ export const validateLanguage = (data) => validateType(data, 'language', LANGUAGES);
@@ -0,0 +1,7 @@
1
+ import { CustomError } from '../../../../error/index.js';
2
+ import { Language } from '../../domains/index.js';
3
+ export type ValidateLanguage = (data?: unknown) => {
4
+ data: Language;
5
+ } | {
6
+ customError: CustomError;
7
+ };
@@ -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-array/index.js';
@@ -0,0 +1 @@
1
+ export * from './is-array/index.js';
@@ -1,2 +1,5 @@
1
- export * from './domains/index.js';
1
+ export * from './array/index.js';
2
+ export * from './string/index.js';
3
+ export * from './type/index.js';
2
4
  export * from './type-guards/index.js';
5
+ export * from './type-map/index.js';
package/src/type/index.js CHANGED
@@ -1,2 +1,5 @@
1
- export * from './domains/index.js';
1
+ export * from './array/index.js';
2
+ export * from './string/index.js';
3
+ export * from './type/index.js';
2
4
  export * from './type-guards/index.js';
5
+ export * from './type-map/index.js';
@@ -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,6 @@
1
+ import { CustomError } from '../../../../error/index.js';
2
+ export declare const validateType: <T>(data: unknown, name: string, valids: readonly T[]) => {
3
+ data: T;
4
+ } | {
5
+ customError: CustomError;
6
+ };
@@ -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 './is-array/index.js';
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 './is-array/index.js';
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 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,3 +0,0 @@
1
- export * from './object/index.js';
2
- export * from './properties-in-object/index.js';
3
- export * from './property-in-object/index.js';
@@ -1,3 +0,0 @@
1
- export * from './object/index.js';
2
- export * from './properties-in-object/index.js';
3
- export * from './property-in-object/index.js';
@@ -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;