Comparing version 0.1.2 to 0.1.3
@@ -238,8 +238,27 @@ // src/cli.ts | ||
} | ||
var myTree = required({ | ||
hello: optional({ | ||
world: null, | ||
$name: optional({ good: required({ morning: null }) }) | ||
}) | ||
}); | ||
function isTreePath(tree, maybePath) { | ||
let currentTreeNode = tree; | ||
for (const segment of maybePath) { | ||
if (currentTreeNode === null) { | ||
return false; | ||
} | ||
if (typeof segment !== `string`) { | ||
return false; | ||
} | ||
if (segment in currentTreeNode[1]) { | ||
currentTreeNode = currentTreeNode[1][segment]; | ||
} else { | ||
return false; | ||
} | ||
} | ||
if (currentTreeNode === null) { | ||
return true; | ||
} | ||
switch (currentTreeNode[0]) { | ||
case `required`: | ||
return false; | ||
case `optional`: | ||
return true; | ||
} | ||
} | ||
@@ -346,4 +365,5 @@ // src/cli.ts | ||
optional, | ||
isTreePath, | ||
encapsulate, | ||
cli | ||
}; |
{ | ||
"name": "comline", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"license": "MIT", | ||
@@ -22,3 +22,3 @@ "author": { | ||
"zod-to-json-schema": "3.23.3", | ||
"treetrunks": "0.0.0" | ||
"treetrunks": "0.0.1" | ||
}, | ||
@@ -25,0 +25,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34193
966
+ Addedtreetrunks@0.0.1(transitive)
- Removedtreetrunks@0.0.0(transitive)
Updatedtreetrunks@0.0.1