fixes in working with top level nodes and root node

This commit is contained in:
azivner
2017-12-23 12:19:15 -05:00
parent 14f44b3271
commit 8bc12a2654
4 changed files with 34 additions and 14 deletions

View File

@@ -75,7 +75,9 @@ function isElectron() {
function assertArguments() {
for (const i in arguments) {
assert(arguments[i], `argument ${i} should not be falsy. Argument list: ${arguments}`);
if (!arguments[i]) {
throwError(`Argument idx#${i} should not be falsy: ${arguments[i]}`);
}
}
}
@@ -83,4 +85,12 @@ function assert(expr, message) {
if (!expr) {
throwError(message);
}
}
function isTopLevelNode(node) {
return isRootNode(node.getParent());
}
function isRootNode(node) {
return node.key === "root_1";
}