@@ -25,6 +25,7 @@ var isCollection = require( '@stdlib/assert-is-collection' );
2525var isIteratorLike = require ( '@stdlib/assert-is-iterator-like' ) ;
2626var isInteger = require ( '@stdlib/assert-is-integer' ) . isPrimitive ;
2727var arraylike2object = require ( '@stdlib/array-base-arraylike2object' ) ;
28+ var format = require ( '@stdlib/string-format' ) ;
2829
2930
3031// MAIN //
@@ -67,10 +68,10 @@ function iterator2arrayview( iterator, out ) {
6768 var v ;
6869
6970 if ( ! isIteratorLike ( iterator ) ) {
70- throw new TypeError ( 'invalid argument. First argument must be an iterator protocol-compliant object. Value: `' + iterator + '`.' ) ;
71+ throw new TypeError ( format ( 'invalid argument. First argument must be an iterator protocol-compliant object. Value: `%s`.' , iterator ) ) ;
7172 }
7273 if ( ! isCollection ( out ) ) {
73- throw new TypeError ( 'invalid argument. Second argument must be an array-like object. Value: `' + out + '`.' ) ;
74+ throw new TypeError ( format ( 'invalid argument. Second argument must be an array-like object. Value: `%s`.' , out ) ) ;
7475 }
7576 nargs = arguments . length ;
7677 if ( nargs === 2 ) {
@@ -108,23 +109,23 @@ function iterator2arrayview( iterator, out ) {
108109 end = arguments [ 3 ] ;
109110 fcn = arguments [ 4 ] ;
110111 if ( ! isFunction ( fcn ) ) {
111- throw new TypeError ( 'invalid argument. Fifth argument must be a callback function. Value: `' + fcn + '`.' ) ;
112+ throw new TypeError ( format ( 'invalid argument. Fifth argument must be a callback function. Value: `%s`.' , fcn ) ) ;
112113 }
113114 }
114115 } else { // nargs > 5
115116 begin = arguments [ 2 ] ;
116117 end = arguments [ 3 ] ;
117118 fcn = arguments [ 4 ] ;
118119 if ( ! isFunction ( fcn ) ) {
119- throw new TypeError ( 'invalid argument. Fifth argument must be a callback function. Value: `' + fcn + '`.' ) ;
120+ throw new TypeError ( format ( 'invalid argument. Fifth argument must be a callback function. Value: `%s`.' , fcn ) ) ;
120121 }
121122 thisArg = arguments [ 5 ] ;
122123 }
123124 if ( ! isInteger ( begin ) ) {
124- throw new TypeError ( 'invalid argument. Third argument must be either an integer (starting index) or a callback function. Value: `' + begin + '`.' ) ;
125+ throw new TypeError ( format ( 'invalid argument. Third argument must be either an integer (starting index) or a callback function. Value: `%s`.' , begin ) ) ;
125126 }
126127 if ( ! isInteger ( end ) ) {
127- throw new TypeError ( 'invalid argument. Fourth argument must be either an integer (ending index) or a callback function. Value: `' + end + '`.' ) ;
128+ throw new TypeError ( format ( 'invalid argument. Fourth argument must be either an integer (ending index) or a callback function. Value: `%s`.' , end ) ) ;
128129 }
129130 if ( end < 0 ) {
130131 end = out . length + end ;
0 commit comments