11'use strict'
22
3- /* Dependencies. */
43var assert = require ( 'assert' )
54var array = require ( 'x-is-array' )
65var object = require ( 'x-is-object' )
@@ -10,11 +9,8 @@ var inspect
109try {
1110 // eslint-disable-next-line no-useless-concat
1211 inspect = require ( 'ut' + 'il' ) . inspect
13- } catch ( error ) {
14- /* Empty. */
15- }
12+ } catch ( error ) { }
1613
17- /* Expose. */
1814exports = wrap ( unist )
1915module . exports = exports
2016
@@ -23,14 +19,14 @@ exports.text = wrap(text)
2319exports . void = wrap ( empty )
2420exports . wrap = wrap
2521
26- /* Identifier to check if a value is seen. */
22+ // Identifier to check if a value is seen.
2723var ID = '__unist__'
2824
29- /* List of specced properties. */
25+ // List of specced properties.
3026var defined = [ 'type' , 'value' , 'children' , 'position' ]
3127
32- /* Wrapper around `Node` which adds the current node
33- * (and parent, if available), to the message. */
28+ // Wrapper around `Node` which adds the current node (and parent, if available),
29+ // to the message.
3430function wrap ( fn ) {
3531 return wrapped
3632
@@ -53,7 +49,7 @@ function wrap(fn) {
5349 }
5450}
5551
56- /* Assert. */
52+ // Assert.
5753function unist ( node ) {
5854 var type
5955 var children
@@ -95,8 +91,8 @@ function unist(node) {
9591 }
9692}
9793
98- /* Assert `value` (which lives at `key`) can be stringified
99- * and re-parsed to the same (deep) value. */
94+ // Assert `value` (which lives at `key`) can be stringified and re-parsed to the
95+ // same (deep) value.
10096function vanilla ( key , value ) {
10197 try {
10298 assert . deepStrictEqual ( value , JSON . parse ( JSON . stringify ( value ) ) )
@@ -105,9 +101,8 @@ function vanilla(key, value) {
105101 }
106102}
107103
108- /* Stringify a value to inspect it. Tries `JSON.stringify()`,
109- * and if that fails uses `String()` instead. If `stringify()`
110- * works. */
104+ // Stringify a value to inspect it.
105+ // Tries `JSON.stringify()`, and if that fails uses `String()` instead.
111106function view ( value ) {
112107 try {
113108 /* eslint-disable no-else-return */
@@ -124,15 +119,15 @@ function view(value) {
124119 }
125120}
126121
127- /* Assert `node` is a parent node. */
122+ // Assert `node` is a parent node.
128123function parent ( node ) {
129124 unist ( node )
130125
131126 assert . strictEqual ( 'value' in node , false , 'parent should not have `value`' )
132127 assert . ok ( 'children' in node , 'parent should have `children`' )
133128}
134129
135- /* Assert `node` is a text node. */
130+ // Assert `node` is a text node.
136131function text ( node ) {
137132 unist ( node )
138133
@@ -144,8 +139,7 @@ function text(node) {
144139 assert . ok ( 'value' in node , 'text should have `value`' )
145140}
146141
147- /* Assert `node` is a Unist node, but neither parent nor
148- * text. */
142+ // Assert `node` is a Unist node, but neither parent nor text.
149143function empty ( node ) {
150144 unist ( node )
151145
@@ -157,7 +151,7 @@ function empty(node) {
157151 )
158152}
159153
160- /* Assert `location` is a Unist Location. */
154+ // Assert `location` is a Unist Location.
161155function location ( location ) {
162156 if ( location != null ) {
163157 assert . ok ( object ( location ) , '`position` should be an object' )
@@ -167,7 +161,7 @@ function location(location) {
167161 }
168162}
169163
170- /* Assert `location` is a Unist Location. */
164+ // Assert `location` is a Unist Location.
171165function position ( position , name ) {
172166 if ( position != null ) {
173167 assert . ok ( object ( position ) , '`' + name + '` should be an object' )
0 commit comments