unist-util-find
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -19,2 +19,2 @@ var remark = require('remark') | ||
}) | ||
.process('Some _emphasis_, **strongness**, and `code`.') | ||
.processSync('Some _emphasis_, **strongness**, and `code`.') |
{ | ||
"name": "unist-util-find", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Unist node finder utility. Useful for working with remark, rehype and retext.", | ||
@@ -24,3 +24,4 @@ "repository": "https://github.com/blahah/unist-util-find", | ||
"devDependencies": { | ||
"standard": "^7.1.2", | ||
"remark": "^7.0.0", | ||
"standard": "^8.0.0", | ||
"tape": "^4.6.0" | ||
@@ -30,5 +31,4 @@ }, | ||
"lodash.iteratee": "^4.5.0", | ||
"remark": "^5.0.1", | ||
"unist-util-visit": "^1.1.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# unist-find [![Travis](https://img.shields.io/travis/blahah/unist-util-find.svg)](https://travis-ci.org/blahah/unist-util-find) | ||
# unist-util-find [![Travis](https://img.shields.io/travis/blahah/unist-util-find.svg)](https://travis-ci.org/blahah/unist-util-find) | ||
@@ -34,3 +34,3 @@ [Unist](https://github.com/wooorm/unist) node finder utility. Useful for working with [remark](https://github.com/wooorm/remark), [rehype](https://github.com/wooorm/rehype) and [retext](https://github.com/wooorm/retext). | ||
}) | ||
.process('Some _emphasis_, **strongness**, and `code`.') | ||
.processSync('Some _emphasis_, **strongness**, and `code`.') | ||
@@ -37,0 +37,0 @@ ``` |
64
test.js
@@ -5,50 +5,46 @@ var test = require('tape') | ||
remark() | ||
.use(function () { return run }) | ||
.process('Some _emphasis_, **strongness**, and `code`.') | ||
test('unist-find', function (t) { | ||
var tree = remark().parse('Some _emphasis_, **strongness**, and `code`.') | ||
function run (tree) { | ||
test('unist-find', function (t) { | ||
t.throws(function () { | ||
find() | ||
}, 'should fail without tree') | ||
t.throws(function () { | ||
find() | ||
}, 'should fail without tree') | ||
t.throws(function () { | ||
find(tree) | ||
}, 'should fail without condition') | ||
t.throws(function () { | ||
find(tree) | ||
}, 'should fail without condition') | ||
t.test('should find with string condition', function (st) { | ||
var result = find(tree, 'value') | ||
t.test('should find with string condition', function (st) { | ||
var result = find(tree, 'value') | ||
st.equal(result, tree.children[0].children[0]) | ||
st.equal(result, tree.children[0].children[0]) | ||
st.end() | ||
}) | ||
st.end() | ||
}) | ||
t.test('should find with object condition', function (st) { | ||
var result = find(tree, { type: 'emphasis' }) | ||
t.test('should find with object condition', function (st) { | ||
var result = find(tree, { type: 'emphasis' }) | ||
st.equal(result, tree.children[0].children[1]) | ||
st.equal(result, tree.children[0].children[1]) | ||
st.end() | ||
st.end() | ||
}) | ||
t.test('should find with function condition', function (st) { | ||
var result = find(tree, function (node) { | ||
return node.type === 'inlineCode' | ||
}) | ||
t.test('should find with function condition', function (st) { | ||
var result = find(tree, function (node) { | ||
return node.type === 'inlineCode' | ||
}) | ||
st.equal(result, tree.children[0].children[5]) | ||
st.equal(result, tree.children[0].children[5]) | ||
st.end() | ||
}) | ||
st.end() | ||
}) | ||
t.test('should return undefined if no matches', function (st) { | ||
var result = find(tree, 'nope, nope, nope') | ||
t.test('should return undefined if no matches', function (st) { | ||
var result = find(tree, 'nope, nope, nope') | ||
st.equal(result, undefined) | ||
st.equal(result, undefined) | ||
st.end() | ||
}) | ||
st.end() | ||
}) | ||
} | ||
}) |
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
2
6451
3
7
83
- Removedremark@^5.0.1
- Removedbail@1.0.5(transitive)
- Removedccount@1.1.0(transitive)
- Removedcharacter-entities@1.2.4(transitive)
- Removedcharacter-entities-html4@1.1.4(transitive)
- Removedcharacter-entities-legacy@1.1.4(transitive)
- Removedcharacter-reference-invalid@1.1.4(transitive)
- Removedcollapse-white-space@1.0.6(transitive)
- Removedextend@3.0.2(transitive)
- Removedhas@1.0.4(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-alphabetical@1.0.4(transitive)
- Removedis-alphanumerical@1.0.4(transitive)
- Removedis-decimal@1.0.4(transitive)
- Removedis-hexadecimal@1.0.4(transitive)
- Removedlongest-streak@1.0.0(transitive)
- Removedmarkdown-table@0.4.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedparse-entities@1.2.2(transitive)
- Removedremark@5.1.0(transitive)
- Removedremark-parse@1.1.0(transitive)
- Removedremark-stringify@1.1.0(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedstringify-entities@1.3.2(transitive)
- Removedtrim@0.0.1(transitive)
- Removedtrim-trailing-lines@1.1.4(transitive)
- Removedtrough@1.0.5(transitive)
- Removedunherit@1.1.3(transitive)
- Removedunified@4.2.1(transitive)
- Removedunist-util-remove-position@1.1.4(transitive)
- Removedvfile@1.4.0(transitive)
- Removedvfile-location@2.0.6(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedxtend@4.0.2(transitive)