Skip to content

Commit

Permalink
Merge branch 'release/2.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
tuananh committed Sep 29, 2017
2 parents dee5843 + e0149a0 commit ec187a4
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ test
benchmark
coverage
examples
lib
lib
intro.png
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ addons:
- ubuntu-toolchain-r-test
packages:
- g++-4.9
cache:
directories:
- $HOME/.npm
before_install:
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then export CXX=clang++; fi
- $CXX --version
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
Here are the benchmarks:

```
camaro x 576 ops/sec ±0.96% (88 runs sampled)
rapidx2j x 175 ops/sec ±0.91% (79 runs sampled)
xml2json x 21.61 ops/sec ±0.83% (39 runs sampled)
xml2js x 21.64 ops/sec ±6.27% (41 runs sampled)
fast-xml-parser x 87.52 ops/sec ±3.49% (64 runs sampled)
camaro x 575 ops/sec ±1.13% (88 runs sampled)
rapidx2j x 177 ops/sec ±1.71% (80 runs sampled)
xml2json x 18.95 ops/sec ±0.78% (50 runs sampled)
xml2js x 34.72 ops/sec ±7.99% (62 runs sampled)
fast-xml-parser x 120 ops/sec ±3.55% (68 runs sampled)
nkit4nodejs x 84.56 ops/sec ±2.09% (71 runs sampled)
xml-js x 27.52 ops/sec ±7.33% (51 runs sampled)
```

* Please note that this is an unfair game for camaro because it only transform what it needs.
Expand Down
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ matrix:
platform:
- x64

cache:
- '%APPDATA%\npm-cache'

# init:
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
install:
Expand Down
5 changes: 5 additions & 0 deletions benchmark/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const xml2json = require('xml2json')
const xml2js = require('xml2js').parseString
const fastXmlParser = require('fast-xml-parser')
const nkit = require('nkit4nodejs')
const xmljs = require('xml-js')

const suite = new benchmark.Suite()
const xml = fs.readFileSync('examples/ean.xml', 'utf-8')
Expand Down Expand Up @@ -69,6 +70,10 @@ suite.add('nkit4nodejs', function() {
const result = builder.end()
})

suite.add('xml-js', function() {
const result = xmljs.xml2json(xml, {compact: true, spaces: 2})
})

suite.on('cycle', cycle)
suite.run()

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "camaro",
"version": "2.0.1",
"version": "2.0.2",
"description": "Transforming XML to JSON using Node.js binding to native pugixml parser library",
"homepage": "https://github.com/tuananh/camaro",
"bugs": "https://github.com/tuananh/camaro/issues",
Expand Down
2 changes: 1 addition & 1 deletion src/pugixml
Submodule pugixml updated 1 files
+6 −1 src/pugixml.cpp
13 changes: 13 additions & 0 deletions test/function.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const xml = `
<unicode>
<item>phòng 2 người</item>
</unicode>
<special>
<item>twin/double@room</item>
</special>
</root>
`

Expand Down Expand Up @@ -59,6 +62,16 @@ t.test('test function title-case() unicode', (t) => {
t.end()
})

t.test('test function title-case() upper after symbols', (t) => {
const result = transform(xml, {
titleCase: ['//special/item', 'title-case(.)']
})
result.titleCase.forEach(u => {
t.equal(u, 'Twin/Double@Room')
})
t.end()
})

t.test('test function camel-case()', (t) => {
const result = transform(xml, {
camelCase: ['//items/item', 'camel-case(.)']
Expand Down

0 comments on commit ec187a4

Please sign in to comment.