@ark/schema
Advanced tools
+1
-1
@@ -426,3 +426,3 @@ import { Callable, appendUnique, flatMorph, includes, isArray, isEmptyObject, isKeyOf, liftArray, printable, stringifyPath, throwError, throwInternalError } from "@ark/util"; | ||
| const referenceMatcher = /"(\$ark\.[^"]+)"/g; | ||
| const compileMeta = (metaJson) => JSON.stringify(metaJson).replaceAll(referenceMatcher, "$1"); | ||
| const compileMeta = (metaJson) => JSON.stringify(metaJson).replace(referenceMatcher, "$1"); | ||
| export const flatRef = (path, node) => ({ | ||
@@ -429,0 +429,0 @@ path, |
@@ -120,4 +120,5 @@ import { flatMorph, hasDomain, includes, isEmptyObject, isKeyOf, throwParseError } from "@ark/util"; | ||
| const sortedRefinementDescriptions = node.prestructurals | ||
| .slice() | ||
| // override alphabetization to describe min before max | ||
| .toSorted((l, r) => (l.kind === "min" && r.kind === "max" ? -1 : 0)) | ||
| .sort((l, r) => (l.kind === "min" && r.kind === "max" ? -1 : 0)) | ||
| .map(r => r.description); | ||
@@ -195,3 +196,3 @@ childDescriptions.push(...sortedRefinementDescriptions); | ||
| } | ||
| this.prestructurals.at(-1).traverseApply(data, ctx); | ||
| this.prestructurals[this.prestructurals.length - 1].traverseApply(data, ctx); | ||
| if (ctx.currentErrorCount > errorCount) | ||
@@ -211,3 +212,3 @@ return; | ||
| } | ||
| this.inner.predicate.at(-1).traverseApply(data, ctx); | ||
| this.inner.predicate[this.inner.predicate.length - 1].traverseApply(data, ctx); | ||
| } | ||
@@ -234,3 +235,3 @@ }; | ||
| } | ||
| js.check(this.prestructurals.at(-1)); | ||
| js.check(this.prestructurals[this.prestructurals.length - 1]); | ||
| if (this.structure || this.inner.predicate) | ||
@@ -251,3 +252,3 @@ js.returnIfFail(); | ||
| } | ||
| js.check(this.inner.predicate.at(-1)); | ||
| js.check(this.inner.predicate[this.inner.predicate.length - 1]); | ||
| } | ||
@@ -254,0 +255,0 @@ } |
@@ -40,3 +40,3 @@ import { type array, type listable } from "@ark/util"; | ||
| compiledMorphs: string; | ||
| lastMorph: BaseRoot<import("./root.ts").InternalRootDeclaration> | Morph<never, unknown> | undefined; | ||
| lastMorph: Morph | BaseRoot | undefined; | ||
| lastMorphIfNode: BaseRoot | undefined; | ||
@@ -43,0 +43,0 @@ introspectableIn: BaseRoot | undefined; |
@@ -82,3 +82,3 @@ import { arrayEquals, liftArray, throwParseError } from "@ark/util"; | ||
| compiledMorphs = `[${this.serializedMorphs}]`; | ||
| lastMorph = this.inner.morphs.at(-1); | ||
| lastMorph = this.inner.morphs[this.inner.morphs.length - 1]; | ||
| lastMorphIfNode = hasArkKind(this.lastMorph, "root") ? this.lastMorph : undefined; | ||
@@ -85,0 +85,0 @@ introspectableIn = this.inner.in; |
@@ -91,3 +91,3 @@ import { ReadonlyPath, stringifyPath } from "@ark/util"; | ||
| get currentBranch() { | ||
| return this.branches.at(-1); | ||
| return this.branches[this.branches.length - 1]; | ||
| } | ||
@@ -172,3 +172,3 @@ queueMorphs(morphs) { | ||
| applyMorphsAtPath(path, morphs) { | ||
| const key = path.at(-1); | ||
| const key = path[path.length - 1]; | ||
| let parent; | ||
@@ -175,0 +175,0 @@ if (key !== undefined) { |
@@ -107,3 +107,3 @@ import { append, conflatenate, printable, throwInternalError, throwParseError } from "@ark/util"; | ||
| // optional elements equivalent to the variadic parameter are redundant | ||
| while (optionals.at(-1)?.equals(raw.variadic)) | ||
| while (optionals[optionals.length - 1]?.equals(raw.variadic)) | ||
| optionals.pop(); | ||
@@ -116,3 +116,3 @@ if (optionals.length === 0 && defaultables.length === 0) { | ||
| // { variadic: number, prefix: [string], minVariadicLength: 1 } | ||
| while (prefix.at(-1)?.equals(raw.variadic)) { | ||
| while (prefix[prefix.length - 1]?.equals(raw.variadic)) { | ||
| prefix.pop(); | ||
@@ -413,4 +413,4 @@ minVariadicLength++; | ||
| return s; | ||
| const lHasPostfix = lTail.at(-1)?.kind === "postfix"; | ||
| const rHasPostfix = rTail.at(-1)?.kind === "postfix"; | ||
| const lHasPostfix = lTail[lTail.length - 1]?.kind === "postfix"; | ||
| const rHasPostfix = rTail[rTail.length - 1]?.kind === "postfix"; | ||
| const kind = lHead.kind === "prefix" || rHead.kind === "prefix" ? "prefix" | ||
@@ -417,0 +417,0 @@ : lHead.kind === "postfix" || rHead.kind === "postfix" ? "postfix" |
+2
-2
| { | ||
| "name": "@ark/schema", | ||
| "version": "0.53.0", | ||
| "version": "0.54.0", | ||
| "license": "MIT", | ||
@@ -40,3 +40,3 @@ "author": { | ||
| "dependencies": { | ||
| "@ark/util": "0.53.0" | ||
| "@ark/util": "0.54.0" | ||
| }, | ||
@@ -43,0 +43,0 @@ "publishConfig": { |
432695
0.04%10115
0.01%+ Added
- Removed
Updated