|
23 | 23 | var isComplexLike = require( '@stdlib/assert-is-complex-like' );
|
24 | 24 | var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;
|
25 | 25 | var isCollection = require( '@stdlib/assert-is-collection' );
|
| 26 | +var format = require( '@stdlib/string-format' ); |
26 | 27 | var isnan = require( '@stdlib/math-base-assert-is-nan' );
|
27 | 28 | var dtype = require( '@stdlib/complex-dtype' );
|
28 | 29 | var adtype = require( '@stdlib/array-dtype' );
|
@@ -75,32 +76,32 @@ function linspace( start, stop, out ) {
|
75 | 76 | dt1 = dtype( start );
|
76 | 77 | if ( dt1 === null ) {
|
77 | 78 | if ( !isComplexLike( start ) ) {
|
78 |
| - throw new TypeError( 'invalid argument. First argument must be either a real or complex number. Value: `' + start + '`.' ); |
| 79 | + throw new TypeError( format( 'invalid argument. First argument must be either a real or complex number. Value: `%s`.', start ) ); |
79 | 80 | }
|
80 | 81 | dt1 = 'complex128';
|
81 | 82 | }
|
82 | 83 | flg = true;
|
83 | 84 | } else if ( !isNumber( start ) || isnan( start ) ) {
|
84 |
| - throw new TypeError( 'invalid argument. First argument must be either a real or complex number. Value: `' + start + '`.' ); |
| 85 | + throw new TypeError( format( 'invalid argument. First argument must be either a real or complex number. Value: `%s`.', start ) ); |
85 | 86 | } else {
|
86 | 87 | dt1 = 'float64';
|
87 | 88 | }
|
88 | 89 | if ( typeof stop === 'object' ) {
|
89 | 90 | dt2 = dtype( stop );
|
90 | 91 | if ( dt2 === null ) {
|
91 | 92 | if ( !isComplexLike( stop ) ) {
|
92 |
| - throw new TypeError( 'invalid argument. Second argument must be either a real or complex number. Value: `' + stop + '`.' ); |
| 93 | + throw new TypeError( format( 'invalid argument. Second argument must be either a real or complex number. Value: `%s`.', stop ) ); |
93 | 94 | }
|
94 | 95 | dt2 = 'complex128';
|
95 | 96 | }
|
96 | 97 | flg = true;
|
97 | 98 | } else if ( !isNumber( stop ) || isnan( stop ) ) {
|
98 |
| - throw new TypeError( 'invalid argument. Second argument must be either a real or complex number. Value: `' + stop + '`.' ); |
| 99 | + throw new TypeError( format( 'invalid argument. Second argument must be either a real or complex number. Value: `%s`.', stop ) ); |
99 | 100 | } else {
|
100 | 101 | dt2 = 'float64';
|
101 | 102 | }
|
102 | 103 | if ( !isCollection( out ) ) {
|
103 |
| - throw new TypeError( 'invalid argument. Third argument must be an array-like object. Value: `' + out + '`.' ); |
| 104 | + throw new TypeError( format( 'invalid argument. Third argument must be an array-like object. Value: `%s`.', out ) ); |
104 | 105 | }
|
105 | 106 | opts = {
|
106 | 107 | 'endpoint': defaults.endpoint
|
|
0 commit comments