unist-utils-core
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -15,1 +15,4 @@ ## 1.0.0 / 2020/05/27 | ||
* Declaration fixes for the test module and visit module. | ||
## 1.0.4 / 2020/06/23 | ||
* Add support for asynchronous visitors. |
@@ -5,2 +5,3 @@ export * from './nodes'; | ||
export * from './visit'; | ||
export * from './visit-async'; | ||
export * from './select'; |
@@ -7,3 +7,4 @@ "use strict"; | ||
tslib_1.__exportStar(require("./visit"), exports); | ||
tslib_1.__exportStar(require("./visit-async"), exports); | ||
tslib_1.__exportStar(require("./select"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -82,2 +82,3 @@ import { Node, Parent } from './nodes'; | ||
} | ||
export declare function vistorResultToTuple(value: any): any; | ||
export declare function visit<T extends Node, P extends Parent>(tree: T | T[], visitor: Visitor<T, P>): any; | ||
@@ -84,0 +85,0 @@ export declare function visit<T extends Node, P extends Parent>(tree: T | T[], visitor: Visitor<T, P>, options: boolean | VisitOptions): any; |
@@ -16,3 +16,3 @@ "use strict"; | ||
exports.EXIT = false; | ||
function toResult(value) { | ||
function vistorResultToTuple(value) { | ||
if (value !== null && typeof value === 'object' && 'length' in value) | ||
@@ -24,2 +24,3 @@ return value; | ||
} | ||
exports.vistorResultToTuple = vistorResultToTuple; | ||
/** | ||
@@ -53,3 +54,3 @@ * Visit nodes (inclusive descendants of tree), with ancestral information. Optionally filtering nodes. Optionally in reverse, Optionally wrapping child visitation with pre/post visits. | ||
if (!tst || is(node, index, parents[parents.length - 1] || null)) { | ||
result = toResult(visitor(node, index, parents)); | ||
result = vistorResultToTuple(visitor(node, index, parents)); | ||
if (result[0] === exports.EXIT) | ||
@@ -59,3 +60,3 @@ return result; | ||
if (node.children && result[0] !== exports.SKIP) { | ||
subResult = toResult(all(node.children, parents.concat(node))); | ||
subResult = vistorResultToTuple(all(node.children, parents.concat(node))); | ||
return subResult[0] === exports.EXIT ? subResult : result; | ||
@@ -62,0 +63,0 @@ } |
{ | ||
"name": "unist-utils-core", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A collection of commonly used (albeit enhanced) algorithms based on unist and unist-util-xxx", | ||
@@ -34,2 +34,9 @@ "author": "Frank Stock", | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/pcafstockf/unist-utils-core.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/pcafstockf/unist-utils-core/issues" | ||
}, | ||
"dependencies": { | ||
@@ -36,0 +43,0 @@ "tslib": "^1.13.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
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
46949
25
408
0
0