Skip to content

Commit 580780a

Browse files
committed
Remove superfluous comments
1 parent c933403 commit 580780a

11 files changed

+21
-190
lines changed

index.js

Lines changed: 14 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
/**
2-
* @author Titus Wormer
3-
* @copyright 2016 Titus Wormer
4-
* @license MIT
5-
* @module unist-util-assert
6-
* @fileoverview Assert `unist` nodes.
7-
*/
8-
91
'use strict';
102

11-
/* eslint-env commonjs */
12-
/* eslint-disable no-useless-concat */
13-
143
/* Dependencies. */
154
var assert = require('assert');
165
var array = require('x-is-array');
@@ -19,6 +8,7 @@ var object = require('x-is-object');
198
var inspect;
209

2110
try {
11+
// eslint-disable-next-line import/no-dynamic-require, no-useless-concat
2212
inspect = require('ut' + 'il').inspect;
2313
} catch (err) { /* Empty. */ }
2414

@@ -36,14 +26,8 @@ var ID = '__unist__';
3626
/* List of specced properties. */
3727
var defined = ['type', 'value', 'children', 'position'];
3828

39-
/**
40-
* Wrapper around `Node` which adds the current node
41-
* (and parent, if available), to the message.
42-
*
43-
* @param {Node} node - Node to checl.
44-
* @param {Node?} [parent] - Parent of `node`.
45-
* @throws {Error} - Prettified error.
46-
*/
29+
/* Wrapper around `Node` which adds the current node
30+
* (and parent, if available), to the message. */
4731
function wrap(fn) {
4832
return wrapped;
4933

@@ -66,13 +50,7 @@ function wrap(fn) {
6650
}
6751
}
6852

69-
/**
70-
* Assert.
71-
*
72-
* @param {Node} node - Value to assert.
73-
* @throws {Error} - If the given value doesn’t adhere to
74-
* unist.
75-
*/
53+
/* Assert. */
7654
function unist(node) {
7755
var type;
7856
var children;
@@ -114,15 +92,8 @@ function unist(node) {
11492
}
11593
}
11694

117-
/**
118-
* Assert `value` (which lives at `key`) can be stringified
119-
* and re-parsed to the same (deep) value.
120-
*
121-
* @param {*} value - Value to assert.
122-
* @param {string} key - Property at which `value` lives.
123-
* @throws {Error} - If the given value doesn’t adhere to
124-
* `Parent`.
125-
*/
95+
/* Assert `value` (which lives at `key`) can be stringified
96+
* and re-parsed to the same (deep) value. */
12697
function vanilla(key, value) {
12798
try {
12899
assert.deepEqual(value, JSON.parse(JSON.stringify(value)));
@@ -131,16 +102,9 @@ function vanilla(key, value) {
131102
}
132103
}
133104

134-
/**
135-
* Stringify a value to inspect it. Tries `JSON.stringify()`,
105+
/* Stringify a value to inspect it. Tries `JSON.stringify()`,
136106
* and if that fails uses `String()` instead. If `stringify()`
137-
* works, ``
138-
*
139-
* @param {*} value - Value to assert.
140-
* @param {string} key - Property at which `value` lives.
141-
* @throws {Error} - If the given value doesn’t adhere to
142-
* `Parent`.
143-
*/
107+
* works. */
144108
function view(value) {
145109
try {
146110
/* eslint-disable no-else-return */
@@ -156,56 +120,32 @@ function view(value) {
156120
}
157121
}
158122

159-
/**
160-
* Assert `node` is a parent node.
161-
*
162-
* @param {Node} node - Value to assert.
163-
* @throws {Error} - If the given value doesn’t adhere to
164-
* `Parent`.
165-
*/
123+
/* Assert `node` is a parent node. */
166124
function parent(node) {
167125
unist(node);
168126

169127
assert.equal('value' in node, false, 'parent should not have `value`');
170128
assert.ok('children' in node, 'parent should have `children`');
171129
}
172130

173-
/**
174-
* Assert `node` is a text node.
175-
*
176-
* @param {Node} node - Value to assert.
177-
* @throws {Error} - If the given value doesn’t adhere to
178-
* `Text`.
179-
*/
131+
/* Assert `node` is a text node. */
180132
function text(node) {
181133
unist(node);
182134

183135
assert.equal('children' in node, false, 'text should not have `children`');
184136
assert.ok('value' in node, 'text should have `value`');
185137
}
186138

187-
/**
188-
* Assert `node` is a Unist node, but neither parent nor
189-
* text.
190-
*
191-
* @param {Node} node - Value to assert.
192-
* @throws {Error} - If the given value doesn’t adhere to
193-
* Unist, is a `Parent`, or a `Text`.
194-
*/
139+
/* Assert `node` is a Unist node, but neither parent nor
140+
* text. */
195141
function empty(node) {
196142
unist(node);
197143

198144
assert.equal('value' in node, false, 'void should not have `value`');
199145
assert.equal('children' in node, false, 'void should not have `children`');
200146
}
201147

202-
/**
203-
* Assert `location` is a Unist Location.
204-
*
205-
* @param {Location} location - Location to assert.
206-
* @throws {Error} - If the given value doesn’t adhere to
207-
* Unist Location.
208-
*/
148+
/* Assert `location` is a Unist Location. */
209149
function location(location) {
210150
if (location != null) {
211151
assert.ok(object(location), '`position` should be an object');
@@ -215,13 +155,7 @@ function location(location) {
215155
}
216156
}
217157

218-
/**
219-
* Assert `location` is a Unist Location.
220-
*
221-
* @param {Location} location - Location to assert.
222-
* @throws {Error} - If the given value doesn’t adhere to
223-
* Unist Location.
224-
*/
158+
/* Assert `location` is a Unist Location. */
225159
function position(position, name) {
226160
if (position != null) {
227161
assert.ok(object(position), '`' + name + '` should be an object');

test/children.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
/**
2-
* @author Titus Wormer
3-
* @copyright 2016 Titus Wormer
4-
* @license MIT
5-
* @module unist-util-assert
6-
* @fileoverview Test suite for `unist-util-assert`.
7-
*/
8-
91
'use strict';
102

11-
/* eslint-env node */
12-
13-
/* Dependencies. */
143
var test = require('tape');
154
var assert = require('..');
165

@@ -27,7 +16,7 @@ test('children', function (t) {
2716
function () {
2817
assert({type: 'foo', children: ['one']});
2918
},
30-
/^AssertionError: node should be an object: `'one'` in `{ type: 'foo', children: \[ 'one' \] }`$/,
19+
/^AssertionError: node should be an object: `'one'` in `{ type: 'foo', children: \[ 'one' ] }`$/,
3120
'should throw if given a non-node child in children'
3221
);
3322

@@ -45,7 +34,7 @@ test('children', function (t) {
4534
children: ['one']
4635
}]});
4736
},
48-
/^AssertionError: node should be an object: `'one'` in `{ type: 'bar', children: \[ 'one' \] }`$/,
37+
/^AssertionError: node should be an object: `'one'` in `{ type: 'bar', children: \[ 'one' ] }`$/,
4938
'should throw on invalid descendants'
5039
);
5140

test/index.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
1-
/**
2-
* @author Titus Wormer
3-
* @copyright 2016 Titus Wormer
4-
* @license MIT
5-
* @module unist-util-assert
6-
* @fileoverview Test suite for `unist-util-assert`.
7-
*/
8-
91
'use strict';
102

11-
/* eslint-env node */
12-
13-
/* Dependencies. */
3+
/* eslint-disable import/no-unassigned-import */
144

15-
/* Tests. */
165
require('./node');
176
require('./type');
187
require('./value');

test/node.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
/**
2-
* @author Titus Wormer
3-
* @copyright 2016 Titus Wormer
4-
* @license MIT
5-
* @module unist-util-assert
6-
* @fileoverview Test suite for `unist-util-assert`.
7-
*/
8-
91
'use strict';
102

11-
/* eslint-env node */
12-
13-
/* Dependencies. */
143
var test = require('tape');
154
var assert = require('..');
165

17-
/* Tests. */
186
test('node', function (t) {
197
t.throws(
208
function () {

test/non-defined.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
/**
2-
* @author Titus Wormer
3-
* @copyright 2016 Titus Wormer
4-
* @license MIT
5-
* @module unist-util-assert
6-
* @fileoverview Test suite for `unist-util-assert`.
7-
*/
8-
91
'use strict';
102

11-
/* eslint-env node */
12-
13-
/* Dependencies. */
143
var test = require('tape');
154
var assert = require('..');
165

17-
/* Tests. */
186
test('non-defined', function (t) {
197
t.doesNotThrow(
208
function () {
@@ -41,7 +29,7 @@ test('non-defined', function (t) {
4129
data: {foo: Function}
4230
});
4331
},
44-
/^AssertionError: non-specced property `data` should be JSON: `{ type: 'break', data: { foo: \[Function: Function\] } }`$/,
32+
/^AssertionError: non-specced property `data` should be JSON: `{ type: 'break', data: { foo: \[Function: Function] } }`$/,
4533
'should throw if non-defined properties are not serialisable'
4634
);
4735

test/parent.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
/**
2-
* @author Titus Wormer
3-
* @copyright 2016 Titus Wormer
4-
* @license MIT
5-
* @module unist-util-assert
6-
* @fileoverview Test suite for `unist-util-assert`.
7-
*/
8-
91
'use strict';
102

11-
/* eslint-env node */
12-
13-
/* Dependencies. */
143
var test = require('tape');
154
var assert = require('..');
165

test/position.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
/**
2-
* @author Titus Wormer
3-
* @copyright 2016 Titus Wormer
4-
* @license MIT
5-
* @module unist-util-assert
6-
* @fileoverview Test suite for `unist-util-assert`.
7-
*/
8-
91
'use strict';
102

11-
/* eslint-env node */
12-
13-
/* Dependencies. */
143
var test = require('tape');
154
var assert = require('..');
165

17-
/* Tests. */
186
test('position', function (t) {
197
t.throws(
208
function () {

test/text.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
/**
2-
* @author Titus Wormer
3-
* @copyright 2016 Titus Wormer
4-
* @license MIT
5-
* @module unist-util-assert
6-
* @fileoverview Test suite for `unist-util-assert`.
7-
*/
8-
91
'use strict';
102

11-
/* eslint-env node */
12-
13-
/* Dependencies. */
143
var test = require('tape');
154
var assert = require('..');
165

@@ -27,7 +16,7 @@ test('assert.text()', function (t) {
2716
function () {
2817
assert.text({type: 'strong', children: []});
2918
},
30-
/^AssertionError: text should not have `children`: `{ type: 'strong', children: \[\] }`$/,
19+
/^AssertionError: text should not have `children`: `{ type: 'strong', children: \[] }`$/,
3120
'should throw if the given node has `children`'
3221
);
3322

test/type.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
1-
/**
2-
* @author Titus Wormer
3-
* @copyright 2016 Titus Wormer
4-
* @license MIT
5-
* @module unist-util-assert
6-
* @fileoverview Test suite for `unist-util-assert`.
7-
*/
8-
91
'use strict';
102

11-
/* eslint-env node */
12-
13-
/* Dependencies. */
143
var test = require('tape');
154
var assert = require('..');
165

17-
/* Tests. */
186
test('type', function (t) {
197
t.throws(
208
function () {
219
assert([1, 5]);
2210
},
23-
/^AssertionError: node should have a type: `\[ 1, 5 \]`$/,
11+
/^AssertionError: node should have a type: `\[ 1, 5 ]`$/,
2412
'should throw if not given a `type` (#1)'
2513
);
2614

test/value.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
/**
2-
* @author Titus Wormer
3-
* @copyright 2016 Titus Wormer
4-
* @license MIT
5-
* @module unist-util-assert
6-
* @fileoverview Test suite for `unist-util-assert`.
7-
*/
8-
91
'use strict';
102

11-
/* eslint-env node */
12-
13-
/* Dependencies. */
143
var test = require('tape');
154
var assert = require('..');
165

test/void.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test('assert.void()', function (t) {
3535
function () {
3636
assert.void({type: 'strong', children: []});
3737
},
38-
/^AssertionError: void should not have `children`: `{ type: 'strong', children: \[\] }`$/,
38+
/^AssertionError: void should not have `children`: `{ type: 'strong', children: \[] }`$/,
3939
'should throw if the given node has `children`'
4040
);
4141

0 commit comments

Comments
 (0)