Skip to content

Commit 4c1c17e

Browse files
committed
Update build process
1 parent dbbae7c commit 4c1c17e

24 files changed

+998
-864
lines changed

Diff for: .dir-locals.el

-1
This file was deleted.

Diff for: .editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

Diff for: .gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
/node_modules/
1+
.DS_Store
2+
*.log
3+
.nyc_output/
4+
coverage/
5+
node_modules/
6+
yarn.lock

Diff for: .prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
coverage/

Diff for: .travis.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: node_js
22
node_js:
3-
- 4
4-
- 8
3+
- lts/boron
4+
- node
5+
after_script: bash <(curl -s https://codecov.io/bash)

Diff for: README.md

-108
This file was deleted.

Diff for: index.js

+30-27
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
1-
'use strict';
1+
'use strict'
22

3-
var parseSelector = require('./lib/selector'),
4-
matchSelector = require('./lib/select');
3+
var debug = require('debug')('unist-util-select')
4+
var parseSelector = require('./lib/selector')
5+
var matchSelector = require('./lib/select')
56

6-
var debug = require('debug')('unist-util-select');
7+
module.exports = select
78

9+
select.one = selectOne
810

9-
var select = function select (ast, selector) {
10-
if (arguments.length == 1) {
11-
return select.bind(this, ast);
11+
function select(ast, selector) {
12+
if (arguments.length === 1) {
13+
return select.bind(this, ast)
1214
}
1315

14-
debug('Selector: %j', selector);
15-
selector = parseSelector(selector);
16-
debug('AST: %s',
17-
JSON.stringify(selector, null, 2).replace(/(^|\n)/g, '\n '));
18-
return selector ? matchSelector[selector.type](selector, ast) : [];
19-
};
20-
21-
22-
select.one = function selectOne (ast, selector) {
23-
if (arguments.length == 1) {
24-
return selectOne.bind(this, ast);
16+
debug('Selector: %j', selector)
17+
selector = parseSelector(selector)
18+
debug(
19+
'AST: %s',
20+
JSON.stringify(selector, null, 2).replace(/(^|\n)/g, '\n ')
21+
)
22+
return selector ? matchSelector[selector.type](selector, ast) : []
23+
}
24+
25+
function selectOne(ast, selector) {
26+
if (arguments.length === 1) {
27+
return selectOne.bind(this, ast)
2528
}
2629

27-
var nodes = select(ast, selector);
30+
var nodes = select(ast, selector)
2831

29-
if (!nodes.length) {
30-
throw Error('Node not found by ' + JSON.stringify(selector));
32+
if (nodes.length === 0) {
33+
throw new Error('Node not found by ' + JSON.stringify(selector))
3134
}
35+
3236
if (nodes.length > 1) {
33-
throw Error('Node matched by ' + JSON.stringify(selector) + ' is not unique');
37+
throw new Error(
38+
'Node matched by ' + JSON.stringify(selector) + ' is not unique'
39+
)
3440
}
3541

36-
return nodes[0];
37-
};
38-
39-
40-
module.exports = select;
42+
return nodes[0]
43+
}

0 commit comments

Comments
 (0)