Comparing version
{ | ||
"name": "xml-query", | ||
"version": "1.3.2", | ||
"version": "1.4.0", | ||
"description": "Super small library to retrieve values and attributes from the XML AST generated by xml-reader", | ||
"main": "build/index.js", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"test": "nyc ava test/test.js", | ||
"test": "nyc --reporter=lcov --reporter=text ava test/test.js --verbose", | ||
"pretest": "tsc", | ||
"prepublish": "npm test", | ||
"report": "nyc report --reporter=html && opn coverage/index.html" | ||
"report": "nyc report --reporter=html && opn coverage/index.html", | ||
"coveralls": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls" | ||
}, | ||
@@ -21,4 +22,8 @@ "keywords": [ | ||
"read", | ||
"tags", | ||
"values", | ||
"attributes", | ||
"find", | ||
"children", | ||
"nodes", | ||
"xpath" | ||
@@ -30,6 +35,7 @@ ], | ||
"ava": "^0.15.2", | ||
"coveralls": "^2.11.14", | ||
"nyc": "^6.6.1", | ||
"opn-cli": "^3.1.0", | ||
"typescript": "^1.8.10", | ||
"xml-reader": "0.0.6" | ||
"xml-reader": "^2.4.3" | ||
}, | ||
@@ -44,2 +50,5 @@ "directories": { | ||
}, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org" | ||
}, | ||
"bugs": { | ||
@@ -46,0 +55,0 @@ "url": "https://github.com/pladaria/xml-query/issues" |
<p align="center"> | ||
<img src="https://raw.githubusercontent.com/pladaria/xml-query/master/logo.png" alt="XML-Query"/> | ||
<img width="80%" src="https://raw.githubusercontent.com/pladaria/xml-query/master/logo.png" alt="XML-Query"/> | ||
</p> | ||
<p align="center"> | ||
Super small (~60 LOC) library for retrieving values and attributes<br> | ||
from the XML AST generated by <a href="http://github.com/pladaria/xml-reader">xml-reader</a><br> | ||
with an easy-to-use jQuery-like interface. | ||
</p> | ||
<p align="center"> | ||
<a href="https://travis-ci.org/pladaria/xml-query"><img src="https://travis-ci.org/pladaria/xml-query.svg" alt="Build Status"/></a> | ||
<a href='https://coveralls.io/github/pladaria/xml-query?branch=master'><img src='https://coveralls.io/repos/github/pladaria/xml-query/badge.svg?branch=master' alt='Coverage Status' /></a> | ||
</p> | ||
Super small (~60 LOC) library for retrieving values and attributes from the XML AST generated by [xml-reader](http://github.com/pladaria/xml-reader). | ||
Provides an easy-to-use jQuery-like interface. | ||
## Install | ||
@@ -74,2 +79,10 @@ | ||
### .has() | ||
Returns `true` if it has the given element. Faster than `find()` because it stops on first occurence. | ||
```javascript | ||
xmlQuery(ast).has('body'); // true | ||
``` | ||
### .attr() | ||
@@ -76,0 +89,0 @@ |
@@ -208,1 +208,7 @@ const test = require('ava'); | ||
}); | ||
test('has', t => { | ||
const ast = xmlReader.parseSync(xmlMessage1); | ||
t.is(xQuery(ast).has('body'), true); | ||
t.is(xQuery(ast).has('nobody'), false); | ||
}); |
16124
9.29%9
12.5%293
5.78%183
7.65%6
20%