Skip to content

Commit

Permalink
change count prop name
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthD committed May 17, 2017
1 parent 0266feb commit 80a08e7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if (program.input) {
}
}).catch(err=>{
console.error('An error came : ', err);
})
});
}
// Start Cli on Folder
if (program.folder) {
Expand Down
4 changes: 2 additions & 2 deletions lib/FromXml.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ class FromXml {
}
// first time we meet this xpath
if(!this._count.hasOwnProperty(parents)){
this._count[parents] = { count: 1, level: level , attributes : attributes };
this._count[parents] = { countElement: 1, level: level , attributes : attributes };
}
else{
// We already meet this xpath , we now merge currAttr with globals attributes
this._count[parents].count++;
this._count[parents].countElement++;
for(let attr in attributes){
if(!this._count[parents].attributes.hasOwnProperty(attr)){
this._count[parents].attributes[attr] = attributes[attr];
Expand Down
8 changes: 4 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ Use it :
```js
let xml = new FromXml().generate('path/to/XML').then(result=> {
for (var key in result) {
console.log(`${path} ${result[path].count}`);
console.log(`${path} ${result[path].countElement}`);
}
});
let xmls = new FromFolder().generateAll(program.folder).then(result=> {
for (var key in result) {
console.log(`${path} ${result[path].count}`);
console.log(`${path} ${result[path].countElement}`);
}
});
```
Expand All @@ -83,7 +83,7 @@ Result will return an array of object like:
[
{
'/path/number/1' : {
count : n,
countElement : n,
level : n,
attributes: {
attr1: ['a','list','of','distinct','values','for','attr1'],
Expand All @@ -94,7 +94,7 @@ Result will return an array of object like:
},
{
'/path/number/2' : {
count : n,
countElement : n,
level : n,
attributes: {
attr1: ['a','list','of','distinct','values','for','attr1'],
Expand Down

3 comments on commit 80a08e7

@parmentf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to rename count to countElement in app.js, lines 59, 67, 81, 88, 96, and 97.

Please test your command before publishing new versions ;).

@MatthD
Copy link
Collaborator Author

@MatthD MatthD commented on 80a08e7 May 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this comment !
I did a major breaking version because of this change, will need a patch for the cli too
The Cli has no test yet, only the api +1

Feel free to contribute François ;)

@MatthD
Copy link
Collaborator Author

@MatthD MatthD commented on 80a08e7 May 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I openned an issue here

#5

Please sign in to comment.