lassy-xpath
Advanced tools
Comparing version 0.3.3 to 0.3.4
{ | ||
"name": "lassy-xpath", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "XPath format and editor for searching LASSY XML files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -55,8 +55,2 @@ "use strict"; | ||
} | ||
if (match[1] == '/' || match[1] == ':') { | ||
// don't indent nodes with a preceding axis, done without | ||
// lookbehind to support more browsers | ||
var end = match.index + match[0].length; | ||
return xpath.substring(0, end) + this.format(xpath.substring(end), indentSize, indentCount); | ||
} | ||
var index = match.index + match[1].length; | ||
@@ -73,2 +67,8 @@ var preceding = xpath.substring(0, index); | ||
} | ||
if (match[1] == '/' || match[1] == ':') { | ||
// don't indent nodes with a preceding axis, done without | ||
// lookbehind to support more browsers | ||
var end = match.index + match[0].length; | ||
return xpath.substring(0, end) + this.format(xpath.substring(end), indentSize, indentCount); | ||
} | ||
var tail = xpath.substring(index + 4); | ||
@@ -75,0 +75,0 @@ return preceding.replace(/ +$/, '') + "\n" + ' '.repeat(indentCount * indentSize) + "node" + this.format(tail, indentSize, indentCount); |
@@ -46,2 +46,4 @@ "use strict"; | ||
expect(parserService.format('//node[@foo and node[@bar or @id="42"]]')).toEqual("//node[@foo and\n node[@bar or @id=\"42\"]]"); | ||
expect(parserService.format("//node[@cat=\"top\" and node[@rel=\"--\" and @cat=\"smain\" and node[@pt=\"vnw\" and @rel=\"su\" and number(@begin) < ../node[@pt=\"ww\" and @rel=\"hd\"]/number(@begin)] and node[@pt=\"ww\" and @rel=\"hd\" and number(@begin) < ../node[@rel=\"predc\" and @cat=\"np\"]/node[@rel=\"det\" and @pt=\"lid\"]/number(@begin)] and node[@rel=\"predc\" and @cat=\"np\" and node[@rel=\"det\" and @pt=\"lid\" and number(@begin) < ../node[@rel=\"hd\" and @pt=\"n\"]/number(@begin)] and node[@rel=\"hd\" and @pt=\"n\" and number(@begin) < ../../../node[@rel=\"--\" and @pt=\"let\"]/number(@begin)]]] and node[@rel=\"--\" and @pt=\"let\"]]")) | ||
.toEqual("//node[@cat=\"top\" and\n node[@rel=\"--\" and @cat=\"smain\" and\n node[@pt=\"vnw\" and @rel=\"su\" and number(@begin) < ../node[@pt=\"ww\" and @rel=\"hd\"]/number(@begin)] and\n node[@pt=\"ww\" and @rel=\"hd\" and number(@begin) < ../node[@rel=\"predc\" and @cat=\"np\"]/node[@rel=\"det\" and @pt=\"lid\"]/number(@begin)] and\n node[@rel=\"predc\" and @cat=\"np\" and\n node[@rel=\"det\" and @pt=\"lid\" and number(@begin) < ../node[@rel=\"hd\" and @pt=\"n\"]/number(@begin)] and\n node[@rel=\"hd\" and @pt=\"n\" and number(@begin) < ../../../node[@rel=\"--\" and @pt=\"let\"]/number(@begin)]]] and\n node[@rel=\"--\" and @pt=\"let\"]]"); | ||
}); | ||
@@ -48,0 +50,0 @@ function expectWarnings(xpath, expectedWarnings) { |
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
282330
3420