inferred-types 0.51.6 → 0.51.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.
@@ -1 +1 @@
1
- {"version":3,"file":"isDateTime.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/date-time/isDateTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAIlE,eAAO,MAAM,aAAa,QAAS,OAAO,KAAG,GAAG,IAAI,eAEnD,CAAA"}
1
+ {"version":3,"file":"isDateTime.d.ts","sourceRoot":"","sources":["../../../../src/runtime/type-guards/date-time/isDateTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAIlE,eAAO,MAAM,aAAa,QAAS,OAAO,KAAG,GAAG,IAAI,eAcnD,CAAA"}
@@ -1,4 +1,13 @@
1
- import { isString, } from "src/runtime/index";
1
+ import { isNumberLike, isString, stripUntil, } from "src/runtime/index";
2
2
  export const isIsoDateTime = (val) => {
3
- return isString(val) && val.includes(":") && val.includes("-") && val.split("-").length === 3 && val.split(":").length > 1;
3
+ if (isString(val)) {
4
+ return isString(val) &&
5
+ val.includes(":") &&
6
+ val.includes("-") &&
7
+ val.split("-").length === 3 &&
8
+ val.split(":").length > 1 &&
9
+ (!val.includes("Z") || isNumberLike(val.slice(-1)) || val.endsWith("Z")) &&
10
+ (!val.includes("Z") || ["+", "-"].includes(stripUntil(val, "Z").slice(1, 2)) || val.endsWith("Z"));
11
+ }
12
+ return false;
4
13
  };
@@ -47,6 +47,8 @@ export * from "./api-tg";
47
47
  export * from "./isBooleanLike";
48
48
  export * from "./isRegExp";
49
49
  export * from "./isAlpha";
50
+ export * from "./isStringArray";
51
+ export * from "./isNumericArray";
50
52
  export * from "./tokens/index";
51
53
  export * from "./higher-order/index";
52
54
  export * from "./tokens/index";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","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;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
@@ -47,6 +47,8 @@ export * from "./api-tg";
47
47
  export * from "./isBooleanLike";
48
48
  export * from "./isRegExp";
49
49
  export * from "./isAlpha";
50
+ export * from "./isStringArray";
51
+ export * from "./isNumericArray";
50
52
  export * from "./tokens/index";
51
53
  export * from "./higher-order/index";
52
54
  export * from "./tokens/index";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type guard which validates that the passed in `val` is a string array.
3
+ */
4
+ export declare const isNumericArray: (val: unknown) => val is number[];
5
+ //# sourceMappingURL=isNumericArray.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isNumericArray.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isNumericArray.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,cAAc,QAAS,OAAO,KAAG,GAAG,IAAI,MAAM,EAE1D,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { isNumber } from "./isNumber";
2
+ /**
3
+ * Type guard which validates that the passed in `val` is a string array.
4
+ */
5
+ export const isNumericArray = (val) => {
6
+ return Array.isArray(val) && val.every(i => isNumber(i));
7
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type guard which validates that the passed in `val` is a string array.
3
+ */
4
+ export declare const isStringArray: (val: unknown) => val is string[];
5
+ //# sourceMappingURL=isStringArray.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isStringArray.d.ts","sourceRoot":"","sources":["../../../src/runtime/type-guards/isStringArray.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,aAAa,QAAS,OAAO,KAAG,GAAG,IAAI,MAAM,EAEzD,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { isString } from "./isString";
2
+ /**
3
+ * Type guard which validates that the passed in `val` is a string array.
4
+ */
5
+ export const isStringArray = (val) => {
6
+ return Array.isArray(val) && val.every(i => isString(i));
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inferred-types",
3
- "version": "0.51.6",
3
+ "version": "0.51.8",
4
4
  "description": "Functions which provide useful type inference on TS projects",
5
5
  "license": "MIT",
6
6
  "author": "Ken Snyder<ken@ken.net>",