File tree 6 files changed +24
-38
lines changed 6 files changed +24
-38
lines changed Original file line number Diff line number Diff line change 1
1
.DS_Store
2
2
* .log
3
- .nyc_output /
4
3
coverage /
5
4
node_modules /
6
- nlcst-to-string.js
7
- nlcst-to-string.min.js
8
5
yarn.lock
Original file line number Diff line number Diff line change 1
1
coverage /
2
- nlcst-to-string.js
3
- nlcst-to-string.min.js
4
- * .json
5
2
* .md
Original file line number Diff line number Diff line change 1
- 'use strict'
2
-
3
- module . exports = nlcstToString
4
-
5
1
// Stringify one nlcst node or list of nodes.
6
- function nlcstToString ( node , separator = '' ) {
2
+ export function toString ( node , separator = '' ) {
7
3
var values
8
4
var length
9
5
var children
@@ -27,7 +23,7 @@ function nlcstToString(node, separator = '') {
27
23
values = [ ]
28
24
29
25
while ( length -- ) {
30
- values [ length ] = nlcstToString ( children [ length ] , separator )
26
+ values [ length ] = toString ( children [ length ] , separator )
31
27
}
32
28
33
29
return values . join ( separator )
Original file line number Diff line number Diff line change 24
24
" Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" ,
25
25
" Kenichiro Murata <kenichiro.murata@gmail.com>"
26
26
],
27
+ "sideEffects" : false ,
28
+ "type" : " module" ,
29
+ "main" : " index.js" ,
27
30
"files" : [
28
31
" index.js"
29
32
],
30
33
"devDependencies" : {
31
- "browserify" : " ^17.0.0" ,
32
- "nyc" : " ^15.0.0" ,
34
+ "c8" : " ^7.0.0" ,
33
35
"prettier" : " ^2.0.0" ,
34
36
"remark-cli" : " ^9.0.0" ,
35
37
"remark-preset-wooorm" : " ^8.0.0" ,
36
38
"tape" : " ^5.0.0" ,
37
- "tinyify" : " ^3.0.0" ,
38
- "unist-builder" : " ^2.0.0" ,
39
+ "unist-builder" : " ^3.0.0" ,
39
40
"xo" : " ^0.38.0"
40
41
},
41
42
"scripts" : {
42
43
"format" : " remark . -qfo && prettier . -w --loglevel warn && xo --fix" ,
43
- "build-bundle" : " browserify . -s nlcstToString -o nlcst-to-string.js" ,
44
- "build-mangle" : " browserify . -s nlcstToString -p tinyify -o nlcst-to-string.min.js" ,
45
- "build" : " npm run build-bundle && npm run build-mangle" ,
46
- "test-api" : " node test" ,
47
- "test-coverage" : " nyc --reporter lcov tape test.js" ,
48
- "test" : " npm run format && npm run build && npm run test-coverage"
49
- },
50
- "nyc" : {
51
- "check-coverage" : true ,
52
- "lines" : 100 ,
53
- "functions" : 100 ,
54
- "branches" : 100
44
+ "test-api" : " node test.js" ,
45
+ "test-coverage" : " c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js" ,
46
+ "test" : " npm run format && npm run test-coverage"
55
47
},
56
48
"prettier" : {
57
49
"tabWidth" : 2 ,
63
55
},
64
56
"xo" : {
65
57
"prettier" : true ,
66
- "esnext " : false ,
67
- "ignore " : [
68
- " nlcst-to-string.js "
69
- ]
58
+ "rules " : {
59
+ "no-var " : " off " ,
60
+ "prefer-arrow-callback" : " off "
61
+ }
70
62
},
71
63
"remarkConfig" : {
72
64
"plugins" : [
Original file line number Diff line number Diff line change 12
12
13
13
## Install
14
14
15
+ This package is [ ESM only] ( https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c ) :
16
+ Node 12+ is needed to use it and it must be ` import ` ed instead of ` require ` d.
17
+
15
18
[ npm] [ ] :
16
19
17
20
``` sh
@@ -21,7 +24,7 @@ npm install nlcst-to-string
21
24
## Use
22
25
23
26
``` js
24
- var toString = require ( ' nlcst-to-string' )
27
+ import { toString } from ' nlcst-to-string'
25
28
26
29
console .log (
27
30
toString ({
@@ -37,6 +40,9 @@ console.log(
37
40
38
41
## API
39
42
43
+ This package exports the following identifiers: ` toString ` .
44
+ There is no default export.
45
+
40
46
### ` toString(node[, separator]) `
41
47
42
48
Stringify the given [ nlcst] [ ] node (or list of nodes).
Original file line number Diff line number Diff line change 1
- 'use strict'
2
-
3
- var test = require ( 'tape' )
4
- var u = require ( 'unist-builder' )
5
- var toString = require ( '.' )
1
+ import test from 'tape'
2
+ import { u } from 'unist-builder'
3
+ import { toString } from './index.js'
6
4
7
5
test ( 'toString()' , function ( t ) {
8
6
t . throws (
You can’t perform that action at this time.
0 commit comments