Skip to content

Commit

Permalink
Bug fix with respect to accepting strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Giuseppe Burtini committed May 21, 2017
1 parent 8e0023e commit 0e9b766
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "potent",
"version": "1.1.0",
"version": "1.1.1",
"description": "XPath rule generalizer - easily learn dynamic matching patterns in XML documents",
"main": "index.js",
"scripts": {
Expand Down
5 changes: 4 additions & 1 deletion src/simplify.js
Expand Up @@ -137,7 +137,10 @@ function simplifyXPath(arrayOfNodes) {
// TODO: sum a cost here.
// TODO: rewrite functionally.
function getSimpleNodeObject(obj) {
return obj instanceof XPathQuery ? obj.nodes : obj;
if (obj instanceof XPathQuery) return obj.nodes;
if (obj instanceof Array) return obj;
if (obj instanceof String) return XPathQuery.fromString(obj);
throw new Error('Invalid type passed to simplify,');
}
let current = getSimpleNodeObject(arrayOfNodes[0]);
for (let i = 1; i < arrayOfNodes.length; i++) {
Expand Down

0 comments on commit 0e9b766

Please sign in to comment.