+2
-1
@@ -45,3 +45,4 @@ import { Callable, throwParseError } from "@ark/util"; | ||
| let argsExpression = params.expression; | ||
| if (argsExpression[0] === "[" && argsExpression.at(-1) === "]") | ||
| if (argsExpression[0] === "[" && | ||
| argsExpression[argsExpression.length - 1] === "]") | ||
| argsExpression = argsExpression.slice(1, -1); | ||
@@ -48,0 +49,0 @@ else if (argsExpression.endsWith("[]")) |
@@ -53,3 +53,3 @@ import { ArkErrors, intrinsic, node, rootSchema } from "@ark/schema"; | ||
| export const isLuhnValid = (creditCardInput) => { | ||
| const sanitized = creditCardInput.replaceAll(/[ -]+/g, ""); | ||
| const sanitized = creditCardInput.replace(/[ -]+/g, ""); | ||
| let sum = 0; | ||
@@ -56,0 +56,0 @@ let digit; |
@@ -94,4 +94,4 @@ import { intrinsic, normalizeIndex } from "@ark/schema"; | ||
| export const preparseKey = (key) => typeof key === "symbol" ? { kind: "required", normalized: key } | ||
| : key.at(-1) === "?" ? | ||
| key.at(-2) === Backslash ? | ||
| : key[key.length - 1] === "?" ? | ||
| key[key.length - 2] === Backslash ? | ||
| { kind: "required", normalized: `${key.slice(0, -2)}?` } | ||
@@ -102,5 +102,5 @@ : { | ||
| } | ||
| : key[0] === "[" && key.at(-1) === "]" ? | ||
| : key[0] === "[" && key[key.length - 1] === "]" ? | ||
| { kind: "index", normalized: key.slice(1, -1) } | ||
| : key[0] === Backslash && key[1] === "[" && key.at(-1) === "]" ? | ||
| : key[0] === Backslash && key[1] === "[" && key[key.length - 1] === "]" ? | ||
| { kind: "required", normalized: key.slice(1) } | ||
@@ -107,0 +107,0 @@ : key === "..." ? { kind: "spread" } |
@@ -143,3 +143,3 @@ import { isKeyOf, throwInternalError, throwParseError, writeUnclosedGroupMessage, writeUnmatchedGroupCloseMessage } from "@ark/util"; | ||
| return (this.branches.leftBound?.comparator ?? | ||
| this.branches.prefixes.at(-1) ?? | ||
| this.branches.prefixes[this.branches.prefixes.length - 1] ?? | ||
| (this.branches.intersection ? "&" | ||
@@ -146,0 +146,0 @@ : this.branches.union ? "|" |
@@ -5,3 +5,3 @@ import { throwParseError, tryParseNumber } from "@ark/util"; | ||
| (value[1] === "'" || value[1] === '"') && | ||
| value.at(-1) === value[1]; | ||
| value[value.length - 1] === value[1]; | ||
| export const isValidDate = (d) => d.toString() !== "Invalid Date"; | ||
@@ -8,0 +8,0 @@ export const extractDateLiteralSource = (literal) => literal.slice(2, -1); |
+1
-1
@@ -32,3 +32,3 @@ import { $ark, BaseScope, hasArkKind, parseGeneric } from "@ark/schema"; | ||
| } | ||
| if (alias.at(-1) !== ">") { | ||
| if (alias[alias.length - 1] !== ">") { | ||
| throwParseError(`'>' must be the last character of a generic declaration in a scope`); | ||
@@ -35,0 +35,0 @@ } |
+1
-1
@@ -39,3 +39,3 @@ import { ArkErrors, BaseRoot, GenericRoot } from "@ark/schema"; | ||
| args[0][0] === "<" && | ||
| args[0].at(-1) === ">") { | ||
| args[0][args[0].length - 1] === ">") { | ||
| // if there are exactly two args, the first of which looks like <${string}>, | ||
@@ -42,0 +42,0 @@ // treat as a generic |
@@ -511,3 +511,3 @@ import type { BaseNode, BaseRoot, Disjoint, JsonSchema, NodeSelector, Predicate, StandardSchemaV1, ToJsonSchema, TypeMeta, UndeclaredKeyBehavior } from "@ark/schema"; | ||
| /** The Type's [StandardSchema](https://github.com/standard-schema/standard-schema) properties */ | ||
| "~standard": StandardSchemaV1.ArkTypeProps<this["inferIn"], this["inferOut"]>; | ||
| "~standard": StandardSchemaV1.ArkTypeProps<this["inferIn"] extends infer _ ? _ : never, this["inferOut"] extends infer _ ? _ : never>; | ||
| /** @deprecated */ | ||
@@ -514,0 +514,0 @@ apply: Function["apply"]; |
+3
-3
| { | ||
| "name": "arktype", | ||
| "description": "TypeScript's 1:1 validator, optimized from editor to runtime", | ||
| "version": "2.1.25", | ||
| "version": "2.1.26", | ||
| "license": "MIT", | ||
@@ -41,5 +41,5 @@ "repository": { | ||
| "dependencies": { | ||
| "@ark/util": "0.53.0", | ||
| "@ark/util": "0.54.0", | ||
| "arkregex": "0.0.2", | ||
| "@ark/schema": "0.53.0" | ||
| "@ark/schema": "0.54.0" | ||
| }, | ||
@@ -46,0 +46,0 @@ "publishConfig": { |
331947
0.06%5907
0.02%+ Added
+ Added
- Removed
Updated
Updated