@gram-data/gram-ast
Advanced tools
Comparing version 0.2.6 to 0.2.7
@@ -9,4 +9,9 @@ { | ||
], | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/gram-data/gram-js.git" | ||
}, | ||
"homepage": "https://github.com/gram-data/gram-js/tree/main/packages/gram-ast#readme", | ||
"main": "dist/index.js", | ||
@@ -25,3 +30,3 @@ "unpkg": "dist/gram-ast.umd.production.min.js", | ||
"start": "tsdx watch", | ||
"build": "tsdx build --format cjs,esm,umd", | ||
"build": "tsdx build --format umd,esm,cjs --tsconfig tsconfig.build.json", | ||
"test": "tsdx test", | ||
@@ -33,3 +38,5 @@ "test:watch": "tsdx test --watch", | ||
"demo": "serve ./public/", | ||
"prepare": "npm run build" | ||
"prepare": "npm run build", | ||
"update": "ncu -u", | ||
"update:check": "ncu" | ||
}, | ||
@@ -48,7 +55,8 @@ "husky": { | ||
"devDependencies": { | ||
"@types/jest": "^26.0.4", | ||
"@types/jest": "^26.0.15", | ||
"@types/shortid": "^0.0.29", | ||
"@types/unist": "^2.0.3", | ||
"@typescript-eslint/parser": "^3.6.1", | ||
"husky": "^4.2.5", | ||
"@typescript-eslint/parser": "^4.6.0", | ||
"husky": "^4.3.0", | ||
"npm-check-updates": "^9.2.3", | ||
"npm-run-all": "^4.1.5", | ||
@@ -58,8 +66,9 @@ "rollup-plugin-node-builtins": "^2.1.2", | ||
"serve": "^11.3.2", | ||
"shx": "^0.3.2", | ||
"tsdx": "^0.13.2", | ||
"tslib": "^2.0.0", | ||
"typescript": "^3.9.7" | ||
"shx": "^0.3.3", | ||
"tsdx": "^0.14.1", | ||
"tslib": "^2.0.3", | ||
"typedoc": "^0.19.2", | ||
"typescript": "^4.0.5" | ||
}, | ||
"gitHead": "0e76e336c21d916b2a79c4425b98578e645aa2c2", | ||
"gitHead": "68f323250363f0ab629388565880339d5c94ed5e", | ||
"publishConfig": { | ||
@@ -66,0 +75,0 @@ "access": "public" |
@@ -26,3 +26,2 @@ /** | ||
export interface GramPathlike extends UnistNode { | ||
/** | ||
@@ -60,3 +59,2 @@ * A unique path identifier. | ||
/** | ||
@@ -115,3 +113,2 @@ * GramPath contains nodes, edges and other paths that have been composed | ||
export interface GramEmptyPath extends GramPathlike { | ||
type: 'path'; | ||
@@ -124,3 +121,2 @@ | ||
record: undefined; | ||
} | ||
@@ -136,7 +132,7 @@ | ||
* other than `ø`. | ||
* | ||
* | ||
* @param o any object | ||
*/ | ||
export const isGramEmptyPath = (o: any): o is GramEmptyPath => | ||
isGramPath(o) && (o.children === undefined) && (o.id === EMPTY_PATH_ID); | ||
isGramPath(o) && o.children === undefined && o.id === EMPTY_PATH_ID; | ||
@@ -158,3 +154,2 @@ /** | ||
export interface GramNode extends GramPath { | ||
/** | ||
@@ -169,3 +164,3 @@ * Optimized to no children, though understood | ||
* Type guard for GramNode. | ||
* | ||
* | ||
* In practice both nodes and empty paths both have no children. | ||
@@ -180,3 +175,6 @@ * The distinguishing feature is that all empty paths have | ||
export const isGramNode = (o: any): o is GramNode => | ||
isGramPath(o) && o.children && (o.children.length === 0) && (o.id !== EMPTY_PATH_ID); | ||
isGramPath(o) && | ||
o.children && | ||
o.children.length === 0 && | ||
o.id !== EMPTY_PATH_ID; | ||
@@ -210,3 +208,2 @@ /** | ||
export interface GramEdge extends GramPath { | ||
/** | ||
@@ -227,5 +224,8 @@ * The operands of the Edge, known as "children" in the AST. | ||
export const isGramEdge = (o: any): o is GramEdge => | ||
isGramPath(o) && (o.relation !== undefined) && (o.relation !== 'pair') && (o.children !== undefined) && o.children.every(child => isGramNode(child)) | ||
isGramPath(o) && | ||
o.relation !== undefined && | ||
o.relation !== 'pair' && | ||
o.children !== undefined && | ||
o.children.every(child => isGramNode(child)); | ||
/** | ||
@@ -232,0 +232,0 @@ * A GramPathSeq is a sequence of paths. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
175723
1994
1
15