@xylabs/typeof 3.6.6 → 3.6.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/browser/ifTypeOf.d.cts +1 -1
- package/dist/browser/ifTypeOf.d.mts +1 -1
- package/dist/browser/ifTypeOf.d.ts +1 -1
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.cts +5 -5
- package/dist/browser/index.d.mts +5 -5
- package/dist/browser/index.d.ts +5 -5
- package/dist/browser/{index.js → index.mjs} +1 -1
- package/dist/{node/index.js.map → browser/index.mjs.map} +1 -1
- package/dist/browser/typeOf.d.cts +1 -1
- package/dist/browser/typeOf.d.mts +1 -1
- package/dist/browser/typeOf.d.ts +1 -1
- package/dist/browser/validateType.d.cts +1 -1
- package/dist/browser/validateType.d.mts +1 -1
- package/dist/browser/validateType.d.ts +1 -1
- package/dist/neutral/ifTypeOf.d.cts +1 -1
- package/dist/neutral/ifTypeOf.d.mts +1 -1
- package/dist/neutral/ifTypeOf.d.ts +1 -1
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.d.cts +5 -5
- package/dist/neutral/index.d.mts +5 -5
- package/dist/neutral/index.d.ts +5 -5
- package/dist/{node/index.js → neutral/index.mjs} +1 -1
- package/dist/{browser/index.js.map → neutral/index.mjs.map} +1 -1
- package/dist/neutral/typeOf.d.cts +1 -1
- package/dist/neutral/typeOf.d.mts +1 -1
- package/dist/neutral/typeOf.d.ts +1 -1
- package/dist/neutral/validateType.d.cts +1 -1
- package/dist/neutral/validateType.d.mts +1 -1
- package/dist/neutral/validateType.d.ts +1 -1
- package/dist/node/ifTypeOf.d.cts +1 -1
- package/dist/node/ifTypeOf.d.mts +1 -1
- package/dist/node/ifTypeOf.d.ts +1 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +5 -5
- package/dist/node/index.d.mts +5 -5
- package/dist/node/index.d.ts +5 -5
- package/dist/{neutral/index.js → node/index.mjs} +1 -1
- package/dist/{neutral/index.js.map → node/index.mjs.map} +1 -1
- package/dist/node/typeOf.d.cts +1 -1
- package/dist/node/typeOf.d.mts +1 -1
- package/dist/node/typeOf.d.ts +1 -1
- package/dist/node/validateType.d.cts +1 -1
- package/dist/node/validateType.d.mts +1 -1
- package/dist/node/validateType.d.ts +1 -1
- package/package.json +9 -9
- package/src/ifDefined.ts +1 -1
- package/src/ifTypeOf.ts +2 -2
- package/src/index.ts +5 -5
- package/src/typeOf.ts +1 -1
- package/src/validateType.ts +2 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
import { TypeOfTypes } from './TypeOfTypes.ts';
|
|
2
2
|
export declare const ifTypeOf: <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => R | undefined;
|
|
3
3
|
//# sourceMappingURL=ifTypeOf.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
import { TypeOfTypes } from './TypeOfTypes.ts';
|
|
2
2
|
export declare const ifTypeOf: <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => R | undefined;
|
|
3
3
|
//# sourceMappingURL=ifTypeOf.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
import { TypeOfTypes } from './TypeOfTypes.ts';
|
|
2
2
|
export declare const ifTypeOf: <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => R | undefined;
|
|
3
3
|
//# sourceMappingURL=ifTypeOf.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/typeOf.ts","../../src/ifDefined.ts","../../src/ifTypeOf.ts","../../src/validateType.ts"],"sourcesContent":["export * from './ifDefined.
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/typeOf.ts","../../src/ifDefined.ts","../../src/ifTypeOf.ts","../../src/validateType.ts"],"sourcesContent":["export * from './ifDefined.ts'\nexport * from './ifTypeOf.ts'\nexport * from './typeOf.ts'\nexport * from './TypeOfTypes.ts'\nexport * from './validateType.ts'\n","import { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const typeOf = <T>(item: T): TypeOfTypes => {\n return Array.isArray(item) ? 'array' : typeof item\n}\n","import { typeOf } from './typeOf.ts'\n\nexport const ifDefined = <T>(value: T, func: (value: T) => void) => {\n switch (typeOf(value)) {\n case 'undefined':\n case 'null': {\n break\n }\n default: {\n func(value)\n return value\n }\n }\n}\n","import { typeOf } from './typeOf.ts'\nimport { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const ifTypeOf = <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => {\n switch (typeOf(value)) {\n case typeName: {\n return !isFunc || isFunc(value as T) ? trueFunc(value as T) : undefined\n }\n }\n}\n","import { typeOf } from './typeOf.ts'\nimport { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const validateType = <T>(typeName: TypeOfTypes, value: T, optional = false): [T | undefined, Error[]] => {\n switch (typeOf(value)) {\n case typeName: {\n return [value, []]\n }\n default: {\n if (optional && typeOf(value) === 'undefined') {\n return [value, []]\n }\n return [undefined, [new Error(`value type is not '${typeName}:${typeof value}'`)]]\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,SAAS,CAAI,SAAyB;AACjD,SAAO,MAAM,QAAQ,IAAI,IAAI,UAAU,OAAO;AAChD;;;ACFO,IAAM,YAAY,CAAI,OAAU,SAA6B;AAClE,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK;AAAA,IACL,KAAK,QAAQ;AACX;AAAA,IACF;AAAA,IACA,SAAS;AACP,WAAK,KAAK;AACV,aAAO;AAAA,IACT;AAAA,EACF;AACF;;;ACVO,IAAM,WAAW,CAAO,UAAuB,OAAgB,UAA2B,WAAmC;AAClI,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK,UAAU;AACb,aAAO,CAAC,UAAU,OAAO,KAAU,IAAI,SAAS,KAAU,IAAI;AAAA,IAChE;AAAA,EACF;AACF;;;ACNO,IAAM,eAAe,CAAI,UAAuB,OAAU,WAAW,UAAoC;AAC9G,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK,UAAU;AACb,aAAO,CAAC,OAAO,CAAC,CAAC;AAAA,IACnB;AAAA,IACA,SAAS;AACP,UAAI,YAAY,OAAO,KAAK,MAAM,aAAa;AAC7C,eAAO,CAAC,OAAO,CAAC,CAAC;AAAA,MACnB;AACA,aAAO,CAAC,QAAW,CAAC,IAAI,MAAM,sBAAsB,QAAQ,IAAI,OAAO,KAAK,GAAG,CAAC,CAAC;AAAA,IACnF;AAAA,EACF;AACF;","names":[]}
|
package/dist/browser/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './ifDefined.
|
|
2
|
-
export * from './ifTypeOf.
|
|
3
|
-
export * from './typeOf.
|
|
4
|
-
export * from './TypeOfTypes.
|
|
5
|
-
export * from './validateType.
|
|
1
|
+
export * from './ifDefined.ts';
|
|
2
|
+
export * from './ifTypeOf.ts';
|
|
3
|
+
export * from './typeOf.ts';
|
|
4
|
+
export * from './TypeOfTypes.ts';
|
|
5
|
+
export * from './validateType.ts';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/browser/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './ifDefined.
|
|
2
|
-
export * from './ifTypeOf.
|
|
3
|
-
export * from './typeOf.
|
|
4
|
-
export * from './TypeOfTypes.
|
|
5
|
-
export * from './validateType.
|
|
1
|
+
export * from './ifDefined.ts';
|
|
2
|
+
export * from './ifTypeOf.ts';
|
|
3
|
+
export * from './typeOf.ts';
|
|
4
|
+
export * from './TypeOfTypes.ts';
|
|
5
|
+
export * from './validateType.ts';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './ifDefined.
|
|
2
|
-
export * from './ifTypeOf.
|
|
3
|
-
export * from './typeOf.
|
|
4
|
-
export * from './TypeOfTypes.
|
|
5
|
-
export * from './validateType.
|
|
1
|
+
export * from './ifDefined.ts';
|
|
2
|
+
export * from './ifTypeOf.ts';
|
|
3
|
+
export * from './typeOf.ts';
|
|
4
|
+
export * from './TypeOfTypes.ts';
|
|
5
|
+
export * from './validateType.ts';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/typeOf.ts","../../src/ifDefined.ts","../../src/ifTypeOf.ts","../../src/validateType.ts"],"sourcesContent":["import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
{"version":3,"sources":["../../src/typeOf.ts","../../src/ifDefined.ts","../../src/ifTypeOf.ts","../../src/validateType.ts"],"sourcesContent":["import { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const typeOf = <T>(item: T): TypeOfTypes => {\n return Array.isArray(item) ? 'array' : typeof item\n}\n","import { typeOf } from './typeOf.ts'\n\nexport const ifDefined = <T>(value: T, func: (value: T) => void) => {\n switch (typeOf(value)) {\n case 'undefined':\n case 'null': {\n break\n }\n default: {\n func(value)\n return value\n }\n }\n}\n","import { typeOf } from './typeOf.ts'\nimport { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const ifTypeOf = <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => {\n switch (typeOf(value)) {\n case typeName: {\n return !isFunc || isFunc(value as T) ? trueFunc(value as T) : undefined\n }\n }\n}\n","import { typeOf } from './typeOf.ts'\nimport { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const validateType = <T>(typeName: TypeOfTypes, value: T, optional = false): [T | undefined, Error[]] => {\n switch (typeOf(value)) {\n case typeName: {\n return [value, []]\n }\n default: {\n if (optional && typeOf(value) === 'undefined') {\n return [value, []]\n }\n return [undefined, [new Error(`value type is not '${typeName}:${typeof value}'`)]]\n }\n }\n}\n"],"mappings":";AAEO,IAAM,SAAS,CAAI,SAAyB;AACjD,SAAO,MAAM,QAAQ,IAAI,IAAI,UAAU,OAAO;AAChD;;;ACFO,IAAM,YAAY,CAAI,OAAU,SAA6B;AAClE,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK;AAAA,IACL,KAAK,QAAQ;AACX;AAAA,IACF;AAAA,IACA,SAAS;AACP,WAAK,KAAK;AACV,aAAO;AAAA,IACT;AAAA,EACF;AACF;;;ACVO,IAAM,WAAW,CAAO,UAAuB,OAAgB,UAA2B,WAAmC;AAClI,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK,UAAU;AACb,aAAO,CAAC,UAAU,OAAO,KAAU,IAAI,SAAS,KAAU,IAAI;AAAA,IAChE;AAAA,EACF;AACF;;;ACNO,IAAM,eAAe,CAAI,UAAuB,OAAU,WAAW,UAAoC;AAC9G,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK,UAAU;AACb,aAAO,CAAC,OAAO,CAAC,CAAC;AAAA,IACnB;AAAA,IACA,SAAS;AACP,UAAI,YAAY,OAAO,KAAK,MAAM,aAAa;AAC7C,eAAO,CAAC,OAAO,CAAC,CAAC;AAAA,MACnB;AACA,aAAO,CAAC,QAAW,CAAC,IAAI,MAAM,sBAAsB,QAAQ,IAAI,OAAO,KAAK,GAAG,CAAC,CAAC;AAAA,IACnF;AAAA,EACF;AACF;","names":[]}
|
package/dist/browser/typeOf.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
import { TypeOfTypes } from './TypeOfTypes.ts';
|
|
2
2
|
export declare const ifTypeOf: <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => R | undefined;
|
|
3
3
|
//# sourceMappingURL=ifTypeOf.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
import { TypeOfTypes } from './TypeOfTypes.ts';
|
|
2
2
|
export declare const ifTypeOf: <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => R | undefined;
|
|
3
3
|
//# sourceMappingURL=ifTypeOf.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
import { TypeOfTypes } from './TypeOfTypes.ts';
|
|
2
2
|
export declare const ifTypeOf: <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => R | undefined;
|
|
3
3
|
//# sourceMappingURL=ifTypeOf.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/typeOf.ts","../../src/ifDefined.ts","../../src/ifTypeOf.ts","../../src/validateType.ts"],"sourcesContent":["export * from './ifDefined.
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/typeOf.ts","../../src/ifDefined.ts","../../src/ifTypeOf.ts","../../src/validateType.ts"],"sourcesContent":["export * from './ifDefined.ts'\nexport * from './ifTypeOf.ts'\nexport * from './typeOf.ts'\nexport * from './TypeOfTypes.ts'\nexport * from './validateType.ts'\n","import { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const typeOf = <T>(item: T): TypeOfTypes => {\n return Array.isArray(item) ? 'array' : typeof item\n}\n","import { typeOf } from './typeOf.ts'\n\nexport const ifDefined = <T>(value: T, func: (value: T) => void) => {\n switch (typeOf(value)) {\n case 'undefined':\n case 'null': {\n break\n }\n default: {\n func(value)\n return value\n }\n }\n}\n","import { typeOf } from './typeOf.ts'\nimport { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const ifTypeOf = <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => {\n switch (typeOf(value)) {\n case typeName: {\n return !isFunc || isFunc(value as T) ? trueFunc(value as T) : undefined\n }\n }\n}\n","import { typeOf } from './typeOf.ts'\nimport { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const validateType = <T>(typeName: TypeOfTypes, value: T, optional = false): [T | undefined, Error[]] => {\n switch (typeOf(value)) {\n case typeName: {\n return [value, []]\n }\n default: {\n if (optional && typeOf(value) === 'undefined') {\n return [value, []]\n }\n return [undefined, [new Error(`value type is not '${typeName}:${typeof value}'`)]]\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,SAAS,CAAI,SAAyB;AACjD,SAAO,MAAM,QAAQ,IAAI,IAAI,UAAU,OAAO;AAChD;;;ACFO,IAAM,YAAY,CAAI,OAAU,SAA6B;AAClE,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK;AAAA,IACL,KAAK,QAAQ;AACX;AAAA,IACF;AAAA,IACA,SAAS;AACP,WAAK,KAAK;AACV,aAAO;AAAA,IACT;AAAA,EACF;AACF;;;ACVO,IAAM,WAAW,CAAO,UAAuB,OAAgB,UAA2B,WAAmC;AAClI,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK,UAAU;AACb,aAAO,CAAC,UAAU,OAAO,KAAU,IAAI,SAAS,KAAU,IAAI;AAAA,IAChE;AAAA,EACF;AACF;;;ACNO,IAAM,eAAe,CAAI,UAAuB,OAAU,WAAW,UAAoC;AAC9G,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK,UAAU;AACb,aAAO,CAAC,OAAO,CAAC,CAAC;AAAA,IACnB;AAAA,IACA,SAAS;AACP,UAAI,YAAY,OAAO,KAAK,MAAM,aAAa;AAC7C,eAAO,CAAC,OAAO,CAAC,CAAC;AAAA,MACnB;AACA,aAAO,CAAC,QAAW,CAAC,IAAI,MAAM,sBAAsB,QAAQ,IAAI,OAAO,KAAK,GAAG,CAAC,CAAC;AAAA,IACnF;AAAA,EACF;AACF;","names":[]}
|
package/dist/neutral/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './ifDefined.
|
|
2
|
-
export * from './ifTypeOf.
|
|
3
|
-
export * from './typeOf.
|
|
4
|
-
export * from './TypeOfTypes.
|
|
5
|
-
export * from './validateType.
|
|
1
|
+
export * from './ifDefined.ts';
|
|
2
|
+
export * from './ifTypeOf.ts';
|
|
3
|
+
export * from './typeOf.ts';
|
|
4
|
+
export * from './TypeOfTypes.ts';
|
|
5
|
+
export * from './validateType.ts';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/neutral/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './ifDefined.
|
|
2
|
-
export * from './ifTypeOf.
|
|
3
|
-
export * from './typeOf.
|
|
4
|
-
export * from './TypeOfTypes.
|
|
5
|
-
export * from './validateType.
|
|
1
|
+
export * from './ifDefined.ts';
|
|
2
|
+
export * from './ifTypeOf.ts';
|
|
3
|
+
export * from './typeOf.ts';
|
|
4
|
+
export * from './TypeOfTypes.ts';
|
|
5
|
+
export * from './validateType.ts';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './ifDefined.
|
|
2
|
-
export * from './ifTypeOf.
|
|
3
|
-
export * from './typeOf.
|
|
4
|
-
export * from './TypeOfTypes.
|
|
5
|
-
export * from './validateType.
|
|
1
|
+
export * from './ifDefined.ts';
|
|
2
|
+
export * from './ifTypeOf.ts';
|
|
3
|
+
export * from './typeOf.ts';
|
|
4
|
+
export * from './TypeOfTypes.ts';
|
|
5
|
+
export * from './validateType.ts';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/typeOf.ts","../../src/ifDefined.ts","../../src/ifTypeOf.ts","../../src/validateType.ts"],"sourcesContent":["import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
{"version":3,"sources":["../../src/typeOf.ts","../../src/ifDefined.ts","../../src/ifTypeOf.ts","../../src/validateType.ts"],"sourcesContent":["import { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const typeOf = <T>(item: T): TypeOfTypes => {\n return Array.isArray(item) ? 'array' : typeof item\n}\n","import { typeOf } from './typeOf.ts'\n\nexport const ifDefined = <T>(value: T, func: (value: T) => void) => {\n switch (typeOf(value)) {\n case 'undefined':\n case 'null': {\n break\n }\n default: {\n func(value)\n return value\n }\n }\n}\n","import { typeOf } from './typeOf.ts'\nimport { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const ifTypeOf = <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => {\n switch (typeOf(value)) {\n case typeName: {\n return !isFunc || isFunc(value as T) ? trueFunc(value as T) : undefined\n }\n }\n}\n","import { typeOf } from './typeOf.ts'\nimport { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const validateType = <T>(typeName: TypeOfTypes, value: T, optional = false): [T | undefined, Error[]] => {\n switch (typeOf(value)) {\n case typeName: {\n return [value, []]\n }\n default: {\n if (optional && typeOf(value) === 'undefined') {\n return [value, []]\n }\n return [undefined, [new Error(`value type is not '${typeName}:${typeof value}'`)]]\n }\n }\n}\n"],"mappings":";AAEO,IAAM,SAAS,CAAI,SAAyB;AACjD,SAAO,MAAM,QAAQ,IAAI,IAAI,UAAU,OAAO;AAChD;;;ACFO,IAAM,YAAY,CAAI,OAAU,SAA6B;AAClE,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK;AAAA,IACL,KAAK,QAAQ;AACX;AAAA,IACF;AAAA,IACA,SAAS;AACP,WAAK,KAAK;AACV,aAAO;AAAA,IACT;AAAA,EACF;AACF;;;ACVO,IAAM,WAAW,CAAO,UAAuB,OAAgB,UAA2B,WAAmC;AAClI,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK,UAAU;AACb,aAAO,CAAC,UAAU,OAAO,KAAU,IAAI,SAAS,KAAU,IAAI;AAAA,IAChE;AAAA,EACF;AACF;;;ACNO,IAAM,eAAe,CAAI,UAAuB,OAAU,WAAW,UAAoC;AAC9G,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK,UAAU;AACb,aAAO,CAAC,OAAO,CAAC,CAAC;AAAA,IACnB;AAAA,IACA,SAAS;AACP,UAAI,YAAY,OAAO,KAAK,MAAM,aAAa;AAC7C,eAAO,CAAC,OAAO,CAAC,CAAC;AAAA,MACnB;AACA,aAAO,CAAC,QAAW,CAAC,IAAI,MAAM,sBAAsB,QAAQ,IAAI,OAAO,KAAK,GAAG,CAAC,CAAC;AAAA,IACnF;AAAA,EACF;AACF;","names":[]}
|
package/dist/neutral/typeOf.d.ts
CHANGED
package/dist/node/ifTypeOf.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
import { TypeOfTypes } from './TypeOfTypes.ts';
|
|
2
2
|
export declare const ifTypeOf: <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => R | undefined;
|
|
3
3
|
//# sourceMappingURL=ifTypeOf.d.ts.map
|
package/dist/node/ifTypeOf.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
import { TypeOfTypes } from './TypeOfTypes.ts';
|
|
2
2
|
export declare const ifTypeOf: <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => R | undefined;
|
|
3
3
|
//# sourceMappingURL=ifTypeOf.d.ts.map
|
package/dist/node/ifTypeOf.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
import { TypeOfTypes } from './TypeOfTypes.ts';
|
|
2
2
|
export declare const ifTypeOf: <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => R | undefined;
|
|
3
3
|
//# sourceMappingURL=ifTypeOf.d.ts.map
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/typeOf.ts","../../src/ifDefined.ts","../../src/ifTypeOf.ts","../../src/validateType.ts"],"sourcesContent":["export * from './ifDefined.
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/typeOf.ts","../../src/ifDefined.ts","../../src/ifTypeOf.ts","../../src/validateType.ts"],"sourcesContent":["export * from './ifDefined.ts'\nexport * from './ifTypeOf.ts'\nexport * from './typeOf.ts'\nexport * from './TypeOfTypes.ts'\nexport * from './validateType.ts'\n","import { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const typeOf = <T>(item: T): TypeOfTypes => {\n return Array.isArray(item) ? 'array' : typeof item\n}\n","import { typeOf } from './typeOf.ts'\n\nexport const ifDefined = <T>(value: T, func: (value: T) => void) => {\n switch (typeOf(value)) {\n case 'undefined':\n case 'null': {\n break\n }\n default: {\n func(value)\n return value\n }\n }\n}\n","import { typeOf } from './typeOf.ts'\nimport { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const ifTypeOf = <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => {\n switch (typeOf(value)) {\n case typeName: {\n return !isFunc || isFunc(value as T) ? trueFunc(value as T) : undefined\n }\n }\n}\n","import { typeOf } from './typeOf.ts'\nimport { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const validateType = <T>(typeName: TypeOfTypes, value: T, optional = false): [T | undefined, Error[]] => {\n switch (typeOf(value)) {\n case typeName: {\n return [value, []]\n }\n default: {\n if (optional && typeOf(value) === 'undefined') {\n return [value, []]\n }\n return [undefined, [new Error(`value type is not '${typeName}:${typeof value}'`)]]\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,SAAS,CAAI,SAAyB;AACjD,SAAO,MAAM,QAAQ,IAAI,IAAI,UAAU,OAAO;AAChD;;;ACFO,IAAM,YAAY,CAAI,OAAU,SAA6B;AAClE,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK;AAAA,IACL,KAAK,QAAQ;AACX;AAAA,IACF;AAAA,IACA,SAAS;AACP,WAAK,KAAK;AACV,aAAO;AAAA,IACT;AAAA,EACF;AACF;;;ACVO,IAAM,WAAW,CAAO,UAAuB,OAAgB,UAA2B,WAAmC;AAClI,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK,UAAU;AACb,aAAO,CAAC,UAAU,OAAO,KAAU,IAAI,SAAS,KAAU,IAAI;AAAA,IAChE;AAAA,EACF;AACF;;;ACNO,IAAM,eAAe,CAAI,UAAuB,OAAU,WAAW,UAAoC;AAC9G,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK,UAAU;AACb,aAAO,CAAC,OAAO,CAAC,CAAC;AAAA,IACnB;AAAA,IACA,SAAS;AACP,UAAI,YAAY,OAAO,KAAK,MAAM,aAAa;AAC7C,eAAO,CAAC,OAAO,CAAC,CAAC;AAAA,MACnB;AACA,aAAO,CAAC,QAAW,CAAC,IAAI,MAAM,sBAAsB,QAAQ,IAAI,OAAO,KAAK,GAAG,CAAC,CAAC;AAAA,IACnF;AAAA,EACF;AACF;","names":[]}
|
package/dist/node/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './ifDefined.
|
|
2
|
-
export * from './ifTypeOf.
|
|
3
|
-
export * from './typeOf.
|
|
4
|
-
export * from './TypeOfTypes.
|
|
5
|
-
export * from './validateType.
|
|
1
|
+
export * from './ifDefined.ts';
|
|
2
|
+
export * from './ifTypeOf.ts';
|
|
3
|
+
export * from './typeOf.ts';
|
|
4
|
+
export * from './TypeOfTypes.ts';
|
|
5
|
+
export * from './validateType.ts';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './ifDefined.
|
|
2
|
-
export * from './ifTypeOf.
|
|
3
|
-
export * from './typeOf.
|
|
4
|
-
export * from './TypeOfTypes.
|
|
5
|
-
export * from './validateType.
|
|
1
|
+
export * from './ifDefined.ts';
|
|
2
|
+
export * from './ifTypeOf.ts';
|
|
3
|
+
export * from './typeOf.ts';
|
|
4
|
+
export * from './TypeOfTypes.ts';
|
|
5
|
+
export * from './validateType.ts';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './ifDefined.
|
|
2
|
-
export * from './ifTypeOf.
|
|
3
|
-
export * from './typeOf.
|
|
4
|
-
export * from './TypeOfTypes.
|
|
5
|
-
export * from './validateType.
|
|
1
|
+
export * from './ifDefined.ts';
|
|
2
|
+
export * from './ifTypeOf.ts';
|
|
3
|
+
export * from './typeOf.ts';
|
|
4
|
+
export * from './TypeOfTypes.ts';
|
|
5
|
+
export * from './validateType.ts';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/typeOf.ts","../../src/ifDefined.ts","../../src/ifTypeOf.ts","../../src/validateType.ts"],"sourcesContent":["import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
{"version":3,"sources":["../../src/typeOf.ts","../../src/ifDefined.ts","../../src/ifTypeOf.ts","../../src/validateType.ts"],"sourcesContent":["import { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const typeOf = <T>(item: T): TypeOfTypes => {\n return Array.isArray(item) ? 'array' : typeof item\n}\n","import { typeOf } from './typeOf.ts'\n\nexport const ifDefined = <T>(value: T, func: (value: T) => void) => {\n switch (typeOf(value)) {\n case 'undefined':\n case 'null': {\n break\n }\n default: {\n func(value)\n return value\n }\n }\n}\n","import { typeOf } from './typeOf.ts'\nimport { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const ifTypeOf = <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => {\n switch (typeOf(value)) {\n case typeName: {\n return !isFunc || isFunc(value as T) ? trueFunc(value as T) : undefined\n }\n }\n}\n","import { typeOf } from './typeOf.ts'\nimport { TypeOfTypes } from './TypeOfTypes.ts'\n\nexport const validateType = <T>(typeName: TypeOfTypes, value: T, optional = false): [T | undefined, Error[]] => {\n switch (typeOf(value)) {\n case typeName: {\n return [value, []]\n }\n default: {\n if (optional && typeOf(value) === 'undefined') {\n return [value, []]\n }\n return [undefined, [new Error(`value type is not '${typeName}:${typeof value}'`)]]\n }\n }\n}\n"],"mappings":";AAEO,IAAM,SAAS,CAAI,SAAyB;AACjD,SAAO,MAAM,QAAQ,IAAI,IAAI,UAAU,OAAO;AAChD;;;ACFO,IAAM,YAAY,CAAI,OAAU,SAA6B;AAClE,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK;AAAA,IACL,KAAK,QAAQ;AACX;AAAA,IACF;AAAA,IACA,SAAS;AACP,WAAK,KAAK;AACV,aAAO;AAAA,IACT;AAAA,EACF;AACF;;;ACVO,IAAM,WAAW,CAAO,UAAuB,OAAgB,UAA2B,WAAmC;AAClI,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK,UAAU;AACb,aAAO,CAAC,UAAU,OAAO,KAAU,IAAI,SAAS,KAAU,IAAI;AAAA,IAChE;AAAA,EACF;AACF;;;ACNO,IAAM,eAAe,CAAI,UAAuB,OAAU,WAAW,UAAoC;AAC9G,UAAQ,OAAO,KAAK,GAAG;AAAA,IACrB,KAAK,UAAU;AACb,aAAO,CAAC,OAAO,CAAC,CAAC;AAAA,IACnB;AAAA,IACA,SAAS;AACP,UAAI,YAAY,OAAO,KAAK,MAAM,aAAa;AAC7C,eAAO,CAAC,OAAO,CAAC,CAAC;AAAA,MACnB;AACA,aAAO,CAAC,QAAW,CAAC,IAAI,MAAM,sBAAsB,QAAQ,IAAI,OAAO,KAAK,GAAG,CAAC,CAAC;AAAA,IACnF;AAAA,EACF;AACF;","names":[]}
|
package/dist/node/typeOf.d.cts
CHANGED
package/dist/node/typeOf.d.mts
CHANGED
package/dist/node/typeOf.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@xylabs/ts-scripts-yarn3": "^3.
|
|
15
|
-
"@xylabs/tsconfig": "^3.
|
|
14
|
+
"@xylabs/ts-scripts-yarn3": "^3.15.5",
|
|
15
|
+
"@xylabs/tsconfig": "^3.15.5",
|
|
16
16
|
"typescript": "^5.5.4"
|
|
17
17
|
},
|
|
18
18
|
"engines": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"default": "./dist/browser/index.cjs"
|
|
27
27
|
},
|
|
28
28
|
"import": {
|
|
29
|
-
"types": "./dist/browser/index.d.
|
|
30
|
-
"default": "./dist/browser/index.
|
|
29
|
+
"types": "./dist/browser/index.d.ts",
|
|
30
|
+
"default": "./dist/browser/index.mjs"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"node": {
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"default": "./dist/node/index.cjs"
|
|
37
37
|
},
|
|
38
38
|
"import": {
|
|
39
|
-
"types": "./dist/node/index.d.
|
|
40
|
-
"default": "./dist/node/index.
|
|
39
|
+
"types": "./dist/node/index.d.ts",
|
|
40
|
+
"default": "./dist/node/index.mjs"
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"./package.json": "./package.json"
|
|
45
45
|
},
|
|
46
46
|
"main": "dist/node/index.cjs",
|
|
47
|
-
"module": "dist/node/index.
|
|
48
|
-
"types": "dist/node/index.d.
|
|
47
|
+
"module": "dist/node/index.mjs",
|
|
48
|
+
"types": "dist/node/index.d.ts",
|
|
49
49
|
"homepage": "https://xylabs.com",
|
|
50
50
|
"license": "LGPL-3.0-only",
|
|
51
51
|
"publishConfig": {
|
|
@@ -63,6 +63,6 @@
|
|
|
63
63
|
"esm"
|
|
64
64
|
],
|
|
65
65
|
"sideEffects": false,
|
|
66
|
-
"version": "3.6.
|
|
66
|
+
"version": "3.6.8",
|
|
67
67
|
"type": "module"
|
|
68
68
|
}
|
package/src/ifDefined.ts
CHANGED
package/src/ifTypeOf.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { typeOf } from './typeOf.
|
|
2
|
-
import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
import { typeOf } from './typeOf.ts'
|
|
2
|
+
import { TypeOfTypes } from './TypeOfTypes.ts'
|
|
3
3
|
|
|
4
4
|
export const ifTypeOf = <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => {
|
|
5
5
|
switch (typeOf(value)) {
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './ifDefined.
|
|
2
|
-
export * from './ifTypeOf.
|
|
3
|
-
export * from './typeOf.
|
|
4
|
-
export * from './TypeOfTypes.
|
|
5
|
-
export * from './validateType.
|
|
1
|
+
export * from './ifDefined.ts'
|
|
2
|
+
export * from './ifTypeOf.ts'
|
|
3
|
+
export * from './typeOf.ts'
|
|
4
|
+
export * from './TypeOfTypes.ts'
|
|
5
|
+
export * from './validateType.ts'
|
package/src/typeOf.ts
CHANGED
package/src/validateType.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { typeOf } from './typeOf.
|
|
2
|
-
import { TypeOfTypes } from './TypeOfTypes.
|
|
1
|
+
import { typeOf } from './typeOf.ts'
|
|
2
|
+
import { TypeOfTypes } from './TypeOfTypes.ts'
|
|
3
3
|
|
|
4
4
|
export const validateType = <T>(typeName: TypeOfTypes, value: T, optional = false): [T | undefined, Error[]] => {
|
|
5
5
|
switch (typeOf(value)) {
|