-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from vnjson/master
remove multiple tags
- Loading branch information
Showing
7 changed files
with
68 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
language: node_js | ||
node_js: | ||
- v6 | ||
- v5 | ||
- v4 | ||
|
||
after_success: | ||
- './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls' | ||
language: node_js | ||
node_js: | ||
- v7 | ||
- v6 | ||
- v5 | ||
- v4 | ||
|
||
after_success: | ||
- './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
environment: | ||
matrix: | ||
- nodejs_version: "7" | ||
- nodejs_version: "6" | ||
- nodejs_version: "5" | ||
- nodejs_version: "4" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
const remove = (tree, {tags}) => tree.match({tag: tags}, node => Object.assign(node, {tag: false, content: []})); | ||
|
||
function removeTags(tree, options) { | ||
return Promise.resolve(tree) | ||
.then(tree => remove(tree, options)) | ||
.then(tree => tree); | ||
} | ||
|
||
export default (options = {}) => { | ||
return tree => new Promise((resolve, reject) => { | ||
if (!Array.isArray(tree)) { | ||
reject(new Error(`tree is not Array`)); | ||
} | ||
|
||
if (tree.length === 0) { | ||
resolve(tree); | ||
} | ||
|
||
resolve(removeTags(tree, Object.assign({}, options))); | ||
}); | ||
}; | ||
export default options => tree => new Promise((resolve, reject) => { | ||
if (!Array.isArray(tree)) { | ||
reject(new Error(`tree is not Array`)); | ||
} | ||
|
||
if (tree.length === 0) { | ||
resolve(tree); | ||
} | ||
|
||
resolve(tree.match(options.tags.map(tag => ({tag: tag})), node => { | ||
node.tag = false; | ||
node.content = []; | ||
return node; | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters