@@ -40,7 +40,7 @@ var Boolean = require( '@stdlib/boolean-ctor' );
4040var getter = require ( '@stdlib/array-base-getter' ) ;
4141var floor = require ( '@stdlib/math-base-special-floor' ) ;
4242var accessorGetter = require ( '@stdlib/array-base-accessor-getter' ) ;
43- var format = require ( '@stdlib/string-format ' ) ;
43+ var format = require ( '@stdlib/error-tools-fmtprodmsg ' ) ;
4444var fromIterator = require ( './from_iterator.js' ) ;
4545var fromIteratorMap = require ( './from_iterator_map.js' ) ;
4646var fromArray = require ( './from_array.js' ) ;
@@ -180,37 +180,37 @@ function BooleanArray() {
180180buf = new Uint8Array ( arg ) ;
181181} else if ( isObject ( arg ) ) {
182182if ( HAS_ITERATOR_SYMBOL === false ) {
183- throw new TypeError ( format ( 'invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`. ' , arg ) ) ;
183+ throw new TypeError ( format ( 'null29 ' , arg ) ) ;
184184}
185185if ( ! isFunction ( arg [ ITERATOR_SYMBOL ] ) ) {
186- throw new TypeError ( format ( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`. ' , arg ) ) ;
186+ throw new TypeError ( format ( 'null2A ' , arg ) ) ;
187187}
188188buf = arg [ ITERATOR_SYMBOL ] ( ) ;
189189if ( ! isFunction ( buf . next ) ) {
190- throw new TypeError ( format ( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`. ' , arg ) ) ;
190+ throw new TypeError ( format ( 'null2A ' , arg ) ) ;
191191}
192192buf = new Uint8Array ( fromIterator ( buf ) ) ;
193193} else {
194- throw new TypeError ( format ( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`. ' , arg ) ) ;
194+ throw new TypeError ( format ( 'null2A ' , arg ) ) ;
195195}
196196} else {
197197buf = arguments [ 0 ] ;
198198if ( ! isArrayBuffer ( buf ) ) {
199- throw new TypeError ( format ( 'invalid argument. First argument must be an ArrayBuffer. Value: `%s`. ' , buf ) ) ;
199+ throw new TypeError ( format ( 'null2B ' , buf ) ) ;
200200}
201201byteOffset = arguments [ 1 ] ;
202202if ( ! isNonNegativeInteger ( byteOffset ) ) {
203- throw new TypeError ( format ( 'invalid argument. Byte offset must be a nonnegative integer. Value: `%s`. ' , byteOffset ) ) ;
203+ throw new TypeError ( format ( 'null2C ' , byteOffset ) ) ;
204204}
205205if ( nargs === 2 ) {
206206buf = new Uint8Array ( buf , byteOffset ) ;
207207} else {
208208len = arguments [ 2 ] ;
209209if ( ! isNonNegativeInteger ( len ) ) {
210- throw new TypeError ( format ( 'invalid argument. Length must be a nonnegative integer. Value: `%s`. ' , len ) ) ;
210+ throw new TypeError ( format ( 'null2F ' , len ) ) ;
211211}
212212if ( ( len * BYTES_PER_ELEMENT ) > ( buf . byteLength - byteOffset ) ) {
213- throw new RangeError ( format ( 'invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`. ' , len * BYTES_PER_ELEMENT ) ) ;
213+ throw new RangeError ( format ( 'null2G ' , len * BYTES_PER_ELEMENT ) ) ;
214214}
215215buf = new Uint8Array ( buf , byteOffset , len ) ;
216216}
@@ -295,7 +295,7 @@ setReadOnly( BooleanArray, 'from', function from( src ) {
295295var len ;
296296var i ;
297297if ( ! isFunction ( this ) ) {
298- throw new TypeError ( 'invalid invocation. `this` context must be a constructor.' ) ;
298+ throw new TypeError ( format ( 'null01' ) ) ;
299299}
300300if ( ! isBooleanArrayConstructor ( this ) ) {
301301throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
@@ -304,7 +304,7 @@ setReadOnly( BooleanArray, 'from', function from( src ) {
304304if ( nargs > 1 ) {
305305clbk = arguments [ 1 ] ;
306306if ( ! isFunction ( clbk ) ) {
307- throw new TypeError ( format ( 'invalid argument. Second argument must be a function. Value: `%s`. ' , clbk ) ) ;
307+ throw new TypeError ( format ( 'null2H ' , clbk ) ) ;
308308}
309309if ( nargs > 2 ) {
310310thisArg = arguments [ 2 ] ;
@@ -330,7 +330,7 @@ setReadOnly( BooleanArray, 'from', function from( src ) {
330330if ( isObject ( src ) && HAS_ITERATOR_SYMBOL && isFunction ( src [ ITERATOR_SYMBOL ] ) ) { // eslint-disable-line max-len
331331buf = src [ ITERATOR_SYMBOL ] ( ) ;
332332if ( ! isFunction ( buf . next ) ) {
333- throw new TypeError ( format ( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`. ' , src ) ) ;
333+ throw new TypeError ( format ( 'null2J ' , src ) ) ;
334334}
335335if ( clbk ) {
336336tmp = fromIteratorMap ( buf , clbk , thisArg ) ;
@@ -345,7 +345,7 @@ setReadOnly( BooleanArray, 'from', function from( src ) {
345345}
346346return out ;
347347}
348- throw new TypeError ( format ( 'invalid argument. First argument must be an array-like object or an iterable. Value: `%s`. ' , src ) ) ;
348+ throw new TypeError ( format ( 'null2J ' , src ) ) ;
349349} ) ;
350350
351351/**
@@ -370,7 +370,7 @@ setReadOnly( BooleanArray, 'of', function of() {
370370var args ;
371371var i ;
372372if ( ! isFunction ( this ) ) {
373- throw new TypeError ( 'invalid invocation. `this` context must be a constructor.' ) ;
373+ throw new TypeError ( format ( 'null01' ) ) ;
374374}
375375if ( ! isBooleanArrayConstructor ( this ) ) {
376376throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
@@ -417,7 +417,7 @@ setReadOnly( BooleanArray.prototype, 'at', function at( idx ) {
417417throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
418418}
419419if ( ! isInteger ( idx ) ) {
420- throw new TypeError ( format ( 'invalid argument. Must provide an integer. Value: `%s`. ' , idx ) ) ;
420+ throw new TypeError ( format ( 'null8A ' , idx ) ) ;
421421}
422422len = this . _length ;
423423buf = this . _buffer ;
@@ -685,7 +685,7 @@ setReadOnly( BooleanArray.prototype, 'every', function every( predicate, thisArg
685685throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
686686}
687687if ( ! isFunction ( predicate ) ) {
688- throw new TypeError ( format ( 'invalid argument. First argument must be a function. Value: `%s`. ' , predicate ) ) ;
688+ throw new TypeError ( format ( 'null3c ' , predicate ) ) ;
689689}
690690buf = this . _buffer ;
691691for ( i = 0 ; i < this . _length ; i ++ ) {
@@ -741,7 +741,7 @@ setReadOnly( BooleanArray.prototype, 'fill', function fill( value, start, end )
741741len = this . _length ;
742742if ( arguments . length > 1 ) {
743743if ( ! isInteger ( start ) ) {
744- throw new TypeError ( format ( 'invalid argument. Second argument must be an integer. Value: `%s`. ' , start ) ) ;
744+ throw new TypeError ( format ( 'null7f ' , start ) ) ;
745745}
746746if ( start < 0 ) {
747747start += len ;
@@ -751,7 +751,7 @@ setReadOnly( BooleanArray.prototype, 'fill', function fill( value, start, end )
751751}
752752if ( arguments . length > 2 ) {
753753if ( ! isInteger ( end ) ) {
754- throw new TypeError ( format ( 'invalid argument. Third argument must be an integer. Value: `%s`. ' , end ) ) ;
754+ throw new TypeError ( format ( 'null2z ' , end ) ) ;
755755}
756756if ( end < 0 ) {
757757end += len ;
@@ -825,7 +825,7 @@ setReadOnly( BooleanArray.prototype, 'filter', function filter( predicate, thisA
825825throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
826826}
827827if ( ! isFunction ( predicate ) ) {
828- throw new TypeError ( format ( 'invalid argument. First argument must be a function. Value: `%s`. ' , predicate ) ) ;
828+ throw new TypeError ( format ( 'null3c ' , predicate ) ) ;
829829}
830830buf = this . _buffer ;
831831out = [ ] ;
@@ -873,7 +873,7 @@ setReadOnly( BooleanArray.prototype, 'find', function find( predicate, thisArg )
873873throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
874874}
875875if ( ! isFunction ( predicate ) ) {
876- throw new TypeError ( format ( 'invalid argument. First argument must be a function. Value: `%s`. ' , predicate ) ) ;
876+ throw new TypeError ( format ( 'null3c ' , predicate ) ) ;
877877}
878878buf = this . _buffer ;
879879for ( i = 0 ; i < this . _length ; i ++ ) {
@@ -919,7 +919,7 @@ setReadOnly( BooleanArray.prototype, 'findIndex', function findIndex( predicate,
919919throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
920920}
921921if ( ! isFunction ( predicate ) ) {
922- throw new TypeError ( format ( 'invalid argument. First argument must be a function. Value: `%s`. ' , predicate ) ) ;
922+ throw new TypeError ( format ( 'null3c ' , predicate ) ) ;
923923}
924924buf = this . _buffer ;
925925for ( i = 0 ; i < this . _length ; i ++ ) {
@@ -966,7 +966,7 @@ setReadOnly( BooleanArray.prototype, 'findLast', function findLast( predicate, t
966966throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
967967}
968968if ( ! isFunction ( predicate ) ) {
969- throw new TypeError ( format ( 'invalid argument. First argument must be a function. Value: `%s`. ' , predicate ) ) ;
969+ throw new TypeError ( format ( 'null3c ' , predicate ) ) ;
970970}
971971buf = this . _buffer ;
972972for ( i = this . _length - 1 ; i >= 0 ; i -- ) {
@@ -1012,7 +1012,7 @@ setReadOnly( BooleanArray.prototype, 'findLastIndex', function findLastIndex( pr
10121012throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
10131013}
10141014if ( ! isFunction ( predicate ) ) {
1015- throw new TypeError ( format ( 'invalid argument. First argument must be a function. Value: `%s`. ' , predicate ) ) ;
1015+ throw new TypeError ( format ( 'null3c ' , predicate ) ) ;
10161016}
10171017buf = this . _buffer ;
10181018for ( i = this . _length - 1 ; i >= 0 ; i -- ) {
@@ -1056,7 +1056,7 @@ setReadOnly( BooleanArray.prototype, 'forEach', function forEach( fcn, thisArg )
10561056throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
10571057}
10581058if ( ! isFunction ( fcn ) ) {
1059- throw new TypeError ( format ( 'invalid argument. First argument must be a function. Value: `%s`. ' , fcn ) ) ;
1059+ throw new TypeError ( format ( 'null3c ' , fcn ) ) ;
10601060}
10611061buf = this . _buffer ;
10621062for ( i = 0 ; i < this . _length ; i ++ ) {
@@ -1094,7 +1094,7 @@ setReadOnly( BooleanArray.prototype, 'get', function get( idx ) {
10941094throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
10951095}
10961096if ( ! isNonNegativeInteger ( idx ) ) {
1097- throw new TypeError ( format ( 'invalid argument. Must provide a nonnegative integer. Value: `%s`. ' , idx ) ) ;
1097+ throw new TypeError ( format ( 'null2K ' , idx ) ) ;
10981098}
10991099if ( idx >= this . _length ) {
11001100return ;
@@ -1142,7 +1142,7 @@ setReadOnly( BooleanArray.prototype, 'includes', function includes( searchElemen
11421142}
11431143if ( arguments . length > 1 ) {
11441144if ( ! isInteger ( fromIndex ) ) {
1145- throw new TypeError ( format ( 'invalid argument. Second argument must be an integer. Value: `%s`. ' , fromIndex ) ) ;
1145+ throw new TypeError ( format ( 'null7f ' , fromIndex ) ) ;
11461146}
11471147if ( fromIndex < 0 ) {
11481148fromIndex += this . _length ;
@@ -1205,7 +1205,7 @@ setReadOnly( BooleanArray.prototype, 'indexOf', function indexOf( searchElement,
12051205}
12061206if ( arguments . length > 1 ) {
12071207if ( ! isInteger ( fromIndex ) ) {
1208- throw new TypeError ( format ( 'invalid argument. Second argument must be an integer. Value: `%s`. ' , fromIndex ) ) ;
1208+ throw new TypeError ( format ( 'null7f ' , fromIndex ) ) ;
12091209}
12101210if ( fromIndex < 0 ) {
12111211fromIndex += this . _length ;
@@ -1259,7 +1259,7 @@ setReadOnly( BooleanArray.prototype, 'join', function join( separator ) {
12591259}
12601260if ( arguments . length > 0 ) {
12611261if ( ! isString ( separator ) ) {
1262- throw new TypeError ( format ( 'invalid argument. First argument must be a string. Value: `%s`. ' , separator ) ) ;
1262+ throw new TypeError ( format ( 'null3F ' , separator ) ) ;
12631263}
12641264} else {
12651265separator = ',' ;
@@ -1421,7 +1421,7 @@ setReadOnly( BooleanArray.prototype, 'lastIndexOf', function lastIndexOf( search
14211421}
14221422if ( arguments . length > 1 ) {
14231423if ( ! isInteger ( fromIndex ) ) {
1424- throw new TypeError ( format ( 'invalid argument. Second argument must be an integer. Value: `%s`. ' , fromIndex ) ) ;
1424+ throw new TypeError ( format ( 'null7f ' , fromIndex ) ) ;
14251425}
14261426if ( fromIndex >= this . _length ) {
14271427fromIndex = this . _length - 1 ;
@@ -1502,7 +1502,7 @@ setReadOnly( BooleanArray.prototype, 'map', function map( fcn, thisArg ) {
15021502throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
15031503}
15041504if ( ! isFunction ( fcn ) ) {
1505- throw new TypeError ( 'invalid argument. First argument must be a function. Value: `%s`.' , fcn ) ;
1505+ throw new TypeError ( format ( 'null3c' ) , fcn ) ;
15061506}
15071507buf = this . _buffer ;
15081508out = new this . constructor ( this . _length ) ;
@@ -1552,7 +1552,7 @@ setReadOnly( BooleanArray.prototype, 'reduce', function reduce( reducer, initial
15521552throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
15531553}
15541554if ( ! isFunction ( reducer ) ) {
1555- throw new TypeError ( format ( 'invalid argument. First argument must be a function. Value: `%s`. ' , reducer ) ) ;
1555+ throw new TypeError ( format ( 'null3c ' , reducer ) ) ;
15561556}
15571557buf = this . _buffer ;
15581558len = this . _length ;
@@ -1611,7 +1611,7 @@ setReadOnly( BooleanArray.prototype, 'reduceRight', function reduceRight( reduce
16111611throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
16121612}
16131613if ( ! isFunction ( reducer ) ) {
1614- throw new TypeError ( format ( 'invalid argument. First argument must be a function. Value: `%s`. ' , reducer ) ) ;
1614+ throw new TypeError ( format ( 'null3c ' , reducer ) ) ;
16151615}
16161616buf = this . _buffer ;
16171617len = this . _length ;
@@ -1742,15 +1742,15 @@ setReadOnly( BooleanArray.prototype, 'set', function set( value ) {
17421742if ( arguments . length > 1 ) {
17431743idx = arguments [ 1 ] ;
17441744if ( ! isNonNegativeInteger ( idx ) ) {
1745- throw new TypeError ( format ( 'invalid argument. Index argument must be a nonnegative integer. Value: `%s`. ' , idx ) ) ;
1745+ throw new TypeError ( format ( 'null2L ' , idx ) ) ;
17461746}
17471747} else {
17481748idx = 0 ;
17491749}
17501750if ( isCollection ( value ) ) {
17511751N = value . length ;
17521752if ( idx + N > this . _length ) {
1753- throw new RangeError ( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' ) ;
1753+ throw new RangeError ( format ( 'null03' ) ) ;
17541754}
17551755if ( isBooleanArray ( value ) ) {
17561756sbuf = value . _buffer ; // eslint-disable-line no-underscore-dangle
@@ -1779,7 +1779,7 @@ setReadOnly( BooleanArray.prototype, 'set', function set( value ) {
17791779return ;
17801780}
17811781if ( idx >= this . _length ) {
1782- throw new RangeError ( format ( 'invalid argument. Index argument is out-of-bounds. Value: `%u`. ' , idx ) ) ;
1782+ throw new RangeError ( format ( 'null2M ' , idx ) ) ;
17831783}
17841784buf [ idx ] = ( value ) ? 1 : 0 ;
17851785} ) ;
@@ -1848,7 +1848,7 @@ setReadOnly( BooleanArray.prototype, 'slice', function slice( begin, end ) {
18481848end = len ;
18491849} else {
18501850if ( ! isInteger ( begin ) ) {
1851- throw new TypeError ( format ( 'invalid argument. First argument must be an integer. Value: `%s`. ' , begin ) ) ;
1851+ throw new TypeError ( format ( 'null7e ' , begin ) ) ;
18521852}
18531853if ( begin < 0 ) {
18541854begin += len ;
@@ -1860,7 +1860,7 @@ setReadOnly( BooleanArray.prototype, 'slice', function slice( begin, end ) {
18601860end = len ;
18611861} else {
18621862if ( ! isInteger ( end ) ) {
1863- throw new TypeError ( format ( 'invalid argument. Second argument must be an integer. Value: `%s`. ' , end ) ) ;
1863+ throw new TypeError ( format ( 'null7f ' , end ) ) ;
18641864}
18651865if ( end < 0 ) {
18661866end += len ;
@@ -1919,7 +1919,7 @@ setReadOnly( BooleanArray.prototype, 'some', function some( predicate, thisArg )
19191919throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
19201920}
19211921if ( ! isFunction ( predicate ) ) {
1922- throw new TypeError ( format ( 'invalid argument. First argument must be a function. Value: `%s`. ' , predicate ) ) ;
1922+ throw new TypeError ( format ( 'null3c ' , predicate ) ) ;
19231923}
19241924buf = this . _buffer ;
19251925for ( i = 0 ; i < this . _length ; i ++ ) {
@@ -1984,7 +1984,7 @@ setReadOnly( BooleanArray.prototype, 'sort', function sort( compareFcn ) {
19841984return this ;
19851985}
19861986if ( ! isFunction ( compareFcn ) ) {
1987- throw new TypeError ( format ( 'invalid argument. First argument must be a function. Value: `%s`. ' , compareFcn ) ) ;
1987+ throw new TypeError ( format ( 'null3c ' , compareFcn ) ) ;
19881988}
19891989buf . sort ( compare ) ;
19901990return this ;
@@ -2063,7 +2063,7 @@ setReadOnly( BooleanArray.prototype, 'subarray', function subarray( begin, end )
20632063end = len ;
20642064} else {
20652065if ( ! isInteger ( begin ) ) {
2066- throw new TypeError ( format ( 'invalid argument. First argument must be an integer. Value: `%s`. ' , begin ) ) ;
2066+ throw new TypeError ( format ( 'null7e ' , begin ) ) ;
20672067}
20682068if ( begin < 0 ) {
20692069begin += len ;
@@ -2075,7 +2075,7 @@ setReadOnly( BooleanArray.prototype, 'subarray', function subarray( begin, end )
20752075end = len ;
20762076} else {
20772077if ( ! isInteger ( end ) ) {
2078- throw new TypeError ( format ( 'invalid argument. Second argument must be an integer. Value: `%s`. ' , end ) ) ;
2078+ throw new TypeError ( format ( 'null7f ' , end ) ) ;
20792079}
20802080if ( end < 0 ) {
20812081end += len ;
@@ -2145,7 +2145,7 @@ setReadOnly( BooleanArray.prototype, 'toLocaleString', function toLocaleString(
21452145} else if ( isObject ( options ) ) {
21462146opts = options ;
21472147} else {
2148- throw new TypeError ( format ( 'invalid argument. Options argument must be an object. Value: `%s`. ' , options ) ) ;
2148+ throw new TypeError ( format ( 'null2V ' , options ) ) ;
21492149}
21502150buf = this . _buffer ;
21512151out = [ ] ;
@@ -2268,7 +2268,7 @@ setReadOnly( BooleanArray.prototype, 'toSorted', function toSorted( compareFcn )
22682268return out ;
22692269}
22702270if ( ! isFunction ( compareFcn ) ) {
2271- throw new TypeError ( format ( 'invalid argument. First argument must be a function. Value: `%s`. ' , compareFcn ) ) ;
2271+ throw new TypeError ( format ( 'null3c ' , compareFcn ) ) ;
22722272}
22732273outbuf . sort ( compare ) ;
22742274return out ;
@@ -2464,17 +2464,17 @@ setReadOnly( BooleanArray.prototype, 'with', function copyWith( index, value ) {
24642464throw new TypeError ( 'invalid invocation. `this` is not a boolean array.' ) ;
24652465}
24662466if ( ! isInteger ( index ) ) {
2467- throw new TypeError ( format ( 'invalid argument. First argument must be an integer. Value: `%s`. ' , index ) ) ;
2467+ throw new TypeError ( format ( 'null7e ' , index ) ) ;
24682468}
24692469len = this . _length ;
24702470if ( index < 0 ) {
24712471index += len ;
24722472}
24732473if ( index < 0 || index >= len ) {
2474- throw new RangeError ( format ( 'invalid argument. Index argument is out-of-bounds. Value: `%s`. ' , index ) ) ;
2474+ throw new RangeError ( format ( 'nullFP ' , index ) ) ;
24752475}
24762476if ( ! isBoolean ( value ) ) {
2477- throw new TypeError ( format ( 'invalid argument. Second argument must be a boolean. Value: `%s`. ' , value ) ) ;
2477+ throw new TypeError ( format ( 'null55 ' , value ) ) ;
24782478}
24792479out = new this . constructor ( this . _buffer ) ;
24802480buf = out . _buffer ; // eslint-disable-line no-underscore-dangle
0 commit comments