Skip to content

Commit 04bcb74

Browse files
committed
fix(assert): resolve README lint errors and improve formatting
1 parent b0b581b commit 04bcb74

File tree

7 files changed

+30
-56
lines changed

7 files changed

+30
-56
lines changed

lib/node_modules/@stdlib/assert/has-same-constructor/README.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# hasSameConstructor
2222

23-
> Test whether two provided values have the same constructor.
23+
> Test whether two provided arguments have the same constructor.
2424
2525
<section class="usage">
2626

@@ -32,22 +32,16 @@ var hasSameConstructor = require( '@stdlib/assert/has-same-constructor' );
3232

3333
#### hasSameConstructor( x, y )
3434

35-
Returns a `boolean` indicating whether two given values has same contructor function.
35+
Tests if two arguments `x` and `y` have the same constructor.
3636

3737
```javascript
38-
var x = 5
39-
var y = 10;
40-
var bool = hasSameConstructor( x, y );
38+
var bool = hasSameConstructor( 5, 10 );
4139
// returns true
4240

43-
x = 5;
44-
y = [];
45-
bool = hasSameConstructor( x, y );
41+
bool = hasSameConstructor( 5, [] );
4642
// returns false
4743

48-
x = [];
49-
y = [];
50-
bool = hasSameConstructor( x, y );
44+
bool = hasSameConstructor( [], [] );
5145
// returns true
5246
```
5347

@@ -91,16 +85,16 @@ bool = hasSameConstructor( x, y );
9185
```javascript
9286
var hasSameConstructor = require( '@stdlib/assert/has-same-constructor' );
9387
94-
var bool = hasSameConstructor( [1, 2, 3], ['a', 'b', 'c'] );
88+
var bool = hasSameConstructor([1, 2, 3], ['a', 'b', 'c']);
9589
// returns true
9690
97-
bool = hasSameConstructor( [1, 2, 3], { 'key': 'value' } );
91+
bool = hasSameConstructor([1, 2, 3], { 'key': 'value' });
9892
// returns false
9993
10094
bool = hasSameConstructor({ 'name': 'Alice' }, { 'age': 30 });
10195
// returns true
10296
103-
bool = hasSameConstructor( { 'name': 'Alice' }, new Date() );
97+
bool = hasSameConstructor({'name': 'Alice' }, new Date());
10498
// returns false
10599
106100
bool = hasSameConstructor( new Date(), new Date() );
@@ -109,7 +103,7 @@ bool = hasSameConstructor( new Date(), new Date() );
109103
bool = hasSameConstructor( null, { 'name': 'Alice' } );
110104
// returns false
111105
112-
bool = hasSameConstructor( undefined, [1, 2, 3] );
106+
bool = hasSameConstructor( void 0, [1, 2, 3] );
113107
// returns false
114108
115109
bool = hasSameConstructor( 42, 3.14 );

lib/node_modules/@stdlib/assert/has-same-constructor/benchmark/benchmark.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ var hasSameConstructor = require( './../lib' );
3333
bench( pkg, function benchmark( b ) {
3434
var values;
3535
var bool;
36+
var x;
37+
var y;
3638
var i;
3739

3840
values = [
@@ -51,13 +53,14 @@ bench( pkg, function benchmark( b ) {
5153

5254
b.tic();
5355
for ( i = 0; i < b.iterations; i++ ) {
54-
bool = hasSameConstructor( values[ i % values.length ], values[ (i+1) % values.length ] );
56+
x = values[ i%values.length ];
57+
y = values[ (i+1)%values.length ];
58+
bool = hasSameConstructor( x, y );
5559
if ( typeof bool !== 'boolean' ) {
5660
b.fail( 'should return a boolean' );
5761
}
5862
}
5963
b.toc();
60-
6164
if ( !isBoolean( bool ) ) {
6265
b.fail( 'should return a boolean' );
6366
}

lib/node_modules/@stdlib/assert/has-same-constructor/docs/repl.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
Parameters
66
----------
7-
a: any
7+
x: any
88
First input value.
99

10-
b: any
10+
y: any
1111
Second input value.
1212

1313
Returns
1414
-------
1515
bool: boolean
16-
Boolean indicating whether two values have same constructor.
16+
Boolean indicating whether two arguments have the same constructor.
1717

1818
Examples
1919
--------

lib/node_modules/@stdlib/assert/has-same-constructor/docs/types/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
* var bool = hasSameConstructor(new String("Hello"), "World");
3838
* // returns true
3939
*/
40-
4140
declare function hasSameConstructor( x: any, y: any ): boolean;
4241

4342

lib/node_modules/@stdlib/assert/has-same-constructor/examples/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,31 @@
2222

2323
var hasSameConstructor = require( './../lib' );
2424

25-
var bool = hasSameConstructor( [1, 2, 3], ['a', 'b', 'c'] );
25+
var bool = hasSameConstructor([1, 2, 3], ['a', 'b', 'c']);
2626
console.log( bool );
2727
// => true
2828

29-
bool = hasSameConstructor( [1, 2, 3], { key: 'value' });
29+
bool = hasSameConstructor([1, 2, 3], { key: 'value' });
3030
console.log( bool );
3131
// => false
3232

3333
bool = hasSameConstructor({ name: 'Alice' }, { age: 30 });
3434
console.log( bool );
3535
// => true
3636

37-
bool = hasSameConstructor({ name: 'Alice' }, new Date() );
37+
bool = hasSameConstructor({ name: 'Alice' }, new Date());
3838
console.log( bool );
3939
// => false
4040

4141
bool = hasSameConstructor( new Date(), new Date() );
4242
console.log( bool );
4343
// => true
4444

45-
bool = hasSameConstructor( null, { name: 'Alice' });
45+
bool = hasSameConstructor(null, { name: 'Alice' });
4646
console.log( bool );
4747
// => false
4848

49-
bool = hasSameConstructor( undefined, [1, 2, 3] );
49+
bool = hasSameConstructor(undefined, [1, 2, 3]);
5050
console.log( bool );
5151
// => false
5252

@@ -58,6 +58,6 @@ bool = hasSameConstructor( 42, 'Hello' );
5858
console.log( bool );
5959
// => false
6060

61-
bool = hasSameConstructor( function () {}, () => {} );
61+
bool = hasSameConstructor(function () {}, () => {});
6262
console.log( bool );
6363
// => true

lib/node_modules/@stdlib/assert/has-same-constructor/lib/index.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,13 @@
2626
* @example
2727
* var hasSameConstructor = require( '@stdlib/assert/has-same-constructor' );
2828
*
29-
* @example
30-
* var x = new Number(5);
31-
* var y = new Number(10);
32-
* var bool = hasSameConstructor( x, y );
29+
* var bool = hasSameConstructor( new Number(5), new Number(10) );
3330
* // returns true
3431
*
35-
* @example
36-
* var x = new Number(5);
37-
* var y = [];
38-
* var bool = hasSameConstructor( x, y );
32+
* bool = hasSameConstructor( new Number(5), [] );
3933
* // returns false
4034
*
41-
* @example
42-
* var x = [];
43-
* var y = [];
44-
* var bool = hasSameConstructor( x, y );
35+
* bool = hasSameConstructor( [], [] );
4536
* // returns true
4637
*/
4738

lib/node_modules/@stdlib/assert/has-same-constructor/lib/main.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,19 @@
2828
* @returns {boolean} boolean indicating whether two arguments have the same native class
2929
*
3030
* @example
31-
* var x = new Number(5);
32-
* var y = new Number(10);
33-
* var bool = hasSameConstructor( x, y );
31+
* var bool = hasSameConstructor( new Number(5), new Number(10) );
3432
* // returns true
3533
*
3634
* @example
37-
* var x = new Number(5);
38-
* var y = [];
39-
* var bool = hasSameConstructor( x, y );
35+
* var bool = hasSameConstructor( new Number(5), [] );
4036
* // returns false
4137
*
4238
* @example
43-
* var x = [];
44-
* var y = [];
45-
* var bool = hasSameConstructor( x, y );
39+
* var bool = hasSameConstructor( [], [] );
4640
* // returns true
4741
*/
48-
// function hasSameConstructor( x, y ) {
49-
// if ( !x || !y ) {
50-
// return false;
51-
// }
52-
// return x.constructor === y.constructor;
53-
// }
54-
5542
function hasSameConstructor( x, y ) {
56-
if (x == null || y == null) { // Check for null or undefined only
43+
if (x == null || y == null) {
5744
return false;
5845
}
5946
return x.constructor === y.constructor;

0 commit comments

Comments
 (0)