tree-visit
Advanced tools
Comparing version 0.2.0 to 0.2.1
"use strict"; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -428,5 +439,10 @@ const access_1 = require("../access"); | ||
var _a; | ||
const { find, access, visit, reduce, flatMap, map } = (0, withOptions_1.withOptions)({ | ||
const _b = (0, withOptions_1.withOptions)({ | ||
getChildren, | ||
}); | ||
}), { find, access, visit, reduce, flatMap, map } = _b, Tree = __rest(_b, ["find", "access", "visit", "reduce", "flatMap", "map"]); | ||
expect(Tree.getChildren(example, []).map((node) => node.name)).toEqual([ | ||
'b', | ||
'c', | ||
]); | ||
expect(Tree.getChildren(example.children[0], []).map((node) => node.name)).toEqual(['b1', 'b2']); | ||
let enterNames = []; | ||
@@ -433,0 +449,0 @@ visit(example, { |
@@ -15,2 +15,8 @@ import { DiagramOptions } from './diagram'; | ||
/** | ||
* Returns the node's children. | ||
* | ||
* This is the same as the `getChildren` option passed to `withOptions`, included here for convenience. | ||
*/ | ||
getChildren: BaseOptions<T>['getChildren']; | ||
/** | ||
* Returns a node by its `IndexPath`. | ||
@@ -17,0 +23,0 @@ * |
@@ -17,2 +17,3 @@ "use strict"; | ||
return { | ||
getChildren: baseOptions.getChildren, | ||
access: (node, indexPath) => (0, access_1.access)(node, indexPath, baseOptions), | ||
@@ -19,0 +20,0 @@ accessPath: (node, indexPath) => (0, access_1.accessPath)(node, indexPath, baseOptions), |
{ | ||
"name": "tree-visit", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A tree traversal library.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
83340
1930