Comparing version 1.0.0 to 1.0.1
@@ -39,2 +39,18 @@ const tt = require('./tokentype'); | ||
function containsToStr(node) { | ||
if (node.name !== 'contains') { | ||
throw new Error('Unsupported function: ' + node.name); | ||
} | ||
if (node.arg.length !== 2) { | ||
throw new Error('Expect contains function to have 2 arguments'); | ||
} | ||
if (node.arg[0].name !== 'text') { | ||
throw new Error('Only text function is supported inside contains'); | ||
} | ||
return ':contains(' + node.arg[1].name + ')'; | ||
} | ||
function predicateToStr(node) { | ||
@@ -46,2 +62,4 @@ switch (node.type) { | ||
return attrFilterToStr(node); | ||
case 'function': | ||
return containsToStr(node); | ||
@@ -48,0 +66,0 @@ default: |
{ | ||
"name": "lc-xpath", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -23,3 +23,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"mocha": "^3.3.0" | ||
"mocha": "^3.4.1" | ||
}, | ||
@@ -26,0 +26,0 @@ "files": [ |
15303
530