Skip to content

Commit cbd8dae

Browse files
committed
Init
0 parents  commit cbd8dae

File tree

8 files changed

+620
-0
lines changed

8 files changed

+620
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules/

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language: node_js
2+
node_js:
3+
- "0.12"
4+
- iojs

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Eugene Sharygin
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[![npm](https://nodei.co/npm/unist-util-select.png)](https://npmjs.com/package/unist-util-select)
2+
3+
# unist-util-select
4+
5+
[![Build Status][travis-badge]][travis] [![Dependency Status][david-badge]][david]
6+
7+
Select unist nodes using css-like selectors.
8+
9+
[travis]: https://travis-ci.org/eush77/unist-util-select
10+
[travis-badge]: https://travis-ci.org/eush77/unist-util-select.svg?branch=master
11+
[david]: https://david-dm.org/eush77/unist-util-select
12+
[david-badge]: https://david-dm.org/eush77/unist-util-select.png
13+
14+
## Install
15+
16+
```
17+
npm install unist-util-select
18+
```
19+
20+
## License
21+
22+
MIT

index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
3+
4+
module.exports = function (ast, selector) {
5+
var result = [];
6+
7+
(function walk (node) {
8+
if (node.type == selector) {
9+
result.push(node);
10+
}
11+
if (node.children) {
12+
node.children.forEach(walk);
13+
}
14+
}(ast));
15+
16+
return result;
17+
};

package.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "unist-util-select",
3+
"version": "0.0.0",
4+
"description": "Select unist nodes using css-like selectors",
5+
"author": "Eugene Sharygin <eush77@gmail.com>",
6+
"license": "MIT",
7+
"scripts": {
8+
"test": "tape test/*.js"
9+
},
10+
"files": [
11+
"index.js"
12+
],
13+
"homepage": "https://github.com/eush77/unist-util-select",
14+
"repository": "eush77/unist-util-select",
15+
"bugs": {
16+
"url": "https://github.com/eush77/unist-util-select/issues"
17+
},
18+
"keywords": [
19+
"css",
20+
"expression",
21+
"mdast",
22+
"node",
23+
"retext",
24+
"select",
25+
"selector",
26+
"tree",
27+
"unist",
28+
"util",
29+
"utility",
30+
"visit",
31+
"walk"
32+
],
33+
"dependencies": {},
34+
"devDependencies": {
35+
"tape": "^4.2.0"
36+
}
37+
}

0 commit comments

Comments
 (0)