diff --git a/CHANGELOG.md b/CHANGELOG.md index 19e31a3..dfa24c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,13 @@
-## Unreleased (2024-11-20) +## Unreleased (2024-11-22)
### Features +- [`e3a2173`](https://github.com/stdlib-js/stdlib/commit/e3a2173a24bd8634f333cace626fc2d71740ebd3) - add `every` method to `array/fixed-endian-factory` [(#3200)](https://github.com/stdlib-js/stdlib/pull/3200) - [`b34732c`](https://github.com/stdlib-js/stdlib/commit/b34732cf655db60fbc798e12952f88c3edb07eaf) - add `at` method to `array/fixed-endian-factory` [(#3184)](https://github.com/stdlib-js/stdlib/pull/3184) - [`956a462`](https://github.com/stdlib-js/stdlib/commit/956a4624c788689b1bca285856b987ea3aa32eb6) - add `forEach` method - [`a3a04e3`](https://github.com/stdlib-js/stdlib/commit/a3a04e32057b878529b86180e38ed3ae383c34ef) - add `array/fixed-endian-factory` @@ -22,9 +23,9 @@ ### Closed Issues -This release closes the following issue: +A total of 2 issues were closed in this release: -[#3135](https://github.com/stdlib-js/stdlib/issues/3135) +[#3135](https://github.com/stdlib-js/stdlib/issues/3135), [#3138](https://github.com/stdlib-js/stdlib/issues/3138)
@@ -36,6 +37,7 @@ This release closes the following issue:
+- [`e3a2173`](https://github.com/stdlib-js/stdlib/commit/e3a2173a24bd8634f333cace626fc2d71740ebd3) - **feat:** add `every` method to `array/fixed-endian-factory` [(#3200)](https://github.com/stdlib-js/stdlib/pull/3200) _(by Aayush Khanna, Athan Reines)_ - [`b34732c`](https://github.com/stdlib-js/stdlib/commit/b34732cf655db60fbc798e12952f88c3edb07eaf) - **feat:** add `at` method to `array/fixed-endian-factory` [(#3184)](https://github.com/stdlib-js/stdlib/pull/3184) _(by Aayush Khanna, Athan Reines)_ - [`956a462`](https://github.com/stdlib-js/stdlib/commit/956a4624c788689b1bca285856b987ea3aa32eb6) - **feat:** add `forEach` method _(by Athan Reines)_ - [`b9f3b77`](https://github.com/stdlib-js/stdlib/commit/b9f3b776e5f3d426629b77206b682836fe6b390f) - **refactor:** reduce string literals _(by Athan Reines)_ diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b2ba387..f09b30e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -85,6 +85,7 @@ Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com> Ryan Seal Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com> SarthakPaandey <145528240+SarthakPaandey@users.noreply.github.com> +Saurabh Singh Seyyed Parsa Neshaei Shashank Shekhar Singh Shivam <11shivam00@gmail.com> diff --git a/README.md b/README.md index 31cfcc4..a7f1717 100644 --- a/README.md +++ b/README.md @@ -371,6 +371,54 @@ v = arr.at( -100 ); // returns undefined ``` + + +#### TypedArrayFE.prototype.every( predicate\[, thisArg] ) + +Tests whether all the elements in an array pass a test implemented by a predicate function. + +```javascript +function isNegative( v ) { + return v < 0; +} + +var Float64ArrayFE = fixedEndianFactory( 'float64' ); + +var arr = new Float64ArrayFE( 'little-endian', [ -1.0, -2.0, -3.0, -4.0 ] ); + +var bool = arr.every( isNegative ); +// returns true +``` + +The invoked function is provided three arguments: + +- **value**: current array element. +- **index**: current array element index. +- **arr**: the array on which this method was called. + +To set the function execution context, provide a `thisArg`. + +```javascript +function isPositive( v, i ) { + this.count += 1; + return v > 0; +} + +var Float64ArrayFE = fixedEndianFactory( 'float64' ); + +var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, -3.0 ] ); + +var context = { + 'count': 0 +}; + +var bool = arr.every( isPositive, context ); +// returns false + +var count = context.count; +// returns 3 +``` + #### TypedArrayFE.prototype.forEach( callbackFn\[, thisArg] ) diff --git a/benchmark/benchmark.every.js b/benchmark/benchmark.every.js new file mode 100644 index 0000000..7a5c447 --- /dev/null +++ b/benchmark/benchmark.every.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench-harness' ); +var isBoolean = require( '@stdlib/assert-is-boolean' ); +var pkg = require( './../package.json' ).name; +var factory = require( './../lib' ); + + +// VARIABLES // + +var Float64ArrayFE = factory( 'float64' ); + + +// MAIN // + +bench( pkg+':every', function benchmark( b ) { + var bool; + var arr; + var i; + + arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 2.0, 1.0 ] ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = arr.every( predicate ); + if ( typeof bool !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( bool ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); + + function predicate( v ) { + return v > 0; + } +}); diff --git a/benchmark/benchmark.every.length.js b/benchmark/benchmark.every.length.js new file mode 100644 index 0000000..5b8d663 --- /dev/null +++ b/benchmark/benchmark.every.length.js @@ -0,0 +1,113 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench-harness' ); +var pow = require( '@stdlib/math-base-special-pow' ); +var zeroTo = require( '@stdlib/array-zero-to' ); +var isBoolean = require( '@stdlib/assert-is-boolean' ); +var pkg = require( './../package.json' ).name; +var factory = require( './../lib' ); + + +// VARIABLES // + +var Float64ArrayFE = factory( 'float64' ); + + +// FUNCTIONS // + +/** +* Predicate function. +* +* @private +* @param {boolean} value - array element +* @param {NonNegativeInteger} idx - array element index +* @param {TypedArray} arr - array instance +* @returns {boolean} boolean indicating whether a value passes a test +*/ +function predicate( value ) { + return value >= 0; +} + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var arr = new Float64ArrayFE( 'little-endian', zeroTo( len ) ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var bool; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + bool = arr.every( predicate ); + if ( typeof bool !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( bool ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':every:len='+len, f ); + } +} + +main(); diff --git a/dist/index.js b/dist/index.js index a67098d..aaac754 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,4 +1,4 @@ -"use strict";var B=function(f,i){return function(){return i||f((i={exports:{}}).exports,i),i.exports}};var N=B(function(mr,Y){"use strict";function Q(f){var i,g;for(i=[];g=f.next(),!g.done;)i.push(g.value);return i}Y.exports=Q});var D=B(function(yr,C){"use strict";function W(f,i,g){var w,E,u;for(w=[],u=-1;E=f.next(),!E.done;)u+=1,w.push(i.call(g,E.value,u));return w}C.exports=W});var K=B(function(pr,J){"use strict";var q=require("@stdlib/assert-is-nonnegative-integer").isPrimitive,X=require("@stdlib/assert-is-integer").isPrimitive,O=require("@stdlib/assert-is-collection"),x=require("@stdlib/assert-is-arraybuffer"),U=require("@stdlib/assert-is-object"),c=require("@stdlib/assert-is-function"),Z=require("@stdlib/assert-is-string").isPrimitive,I=require("@stdlib/array-base-assert-is-byte-order"),$=require("@stdlib/string-base-lowercase"),rr=require("@stdlib/assert-has-iterator-symbol-support"),A=require("@stdlib/symbol-iterator"),h=require("@stdlib/utils-define-nonenumerable-read-only-property"),er=require("@stdlib/assert-is-prototype-of"),V=require("@stdlib/utils-define-nonenumerable-read-only-accessor"),R=require("@stdlib/array-buffer"),b=require("@stdlib/array-dataview"),S=require("@stdlib/array-base-getter"),P=require("@stdlib/array-base-accessor-getter"),tr=require("@stdlib/array-base-assert-contains").factory,nr=require("@stdlib/ndarray-base-bytes-per-element"),ir=require("@stdlib/string-base-capitalize"),s=require("@stdlib/string-format"),G=N(),ar=D(),H=rr(),or=["float64","float32","int32","int16","uint32","uint16"],ur={float64:"setFloat64",float32:"setFloat32",int32:"setInt32",int16:"setInt16",uint32:"setUint32",uint16:"setUint16"},sr={float64:"getFloat64",float32:"getFloat32",int32:"getInt32",int16:"getInt16",uint32:"getUint32",uint16:"getUint16"},d={c:"a",f:"a",i:"an",u:"a",b:"a"},fr=tr(or);function k(f){return Z(f)?$(f):null}function z(f){return f==="little-endian"}function lr(f){return ir(f)+"ArrayFE"}function gr(f){var i,g,w,E;if(!fr(f))throw new TypeError(s("invalid argument. First argument must be a supported data type. Value: `%s`.",f));i=nr(f),g=lr(f),w=sr[f],E=ur[f];function u(){var o,t,r,n,e,l,a,y;if(r=arguments.length,!(this instanceof u))return r<2?new u(arguments[0]):r===2?new u(arguments[0],arguments[1]):r===3?new u(arguments[0],arguments[1],arguments[2]):new u(arguments[0],arguments[1],arguments[2],arguments[3]);if(t=k(arguments[0]),t===null||!I(t))throw new TypeError(s("invalid argument. First argument must be a supported byte order. Value: `%s`.",arguments[0]));if(n=z(t),r-=1,r===0)e=new b(new R(0));else if(r===1)if(a=arguments[r],q(a))e=new b(new R(a*i));else if(O(a))e=j(new b(new R(a.length*i)),a,n);else if(x(a))e=new b(a);else if(U(a)){if(H===!1)throw new TypeError(s("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.",a));if(!c(a[A]))throw new TypeError(s("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",a));if(e=a[A](),!c(e.next))throw new TypeError(s("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",a));y=G(e),e=j(new b(new R(y.length*i)),y,n)}else throw new TypeError(s("invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.",a));else{if(e=arguments[1],!x(e))throw new TypeError(s("invalid argument. Must provide an ArrayBuffer. Value: `%s`.",e));if(o=arguments[2],!q(o))throw new TypeError(s("invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.",o));if(r===2)e=new b(e,o);else{if(l=arguments[3],!q(l))throw new TypeError(s("invalid argument. Length must be a nonnegative integer. Value: `%s`.",l));if(l*=i,l>e.byteLength-o)throw new RangeError(s("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",l));e=new b(e,o,l)}}return h(this,"_buffer",e),h(this,"_length",e.byteLength/i),h(this,"_isLE",n),this}return h(u,"BYTES_PER_ELEMENT",i),h(u,"name",g),h(u,"from",function(t,r){var n,e,l,a,y,v,m,L,M,T,p;if(!c(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!F(this))throw new TypeError(s("invalid invocation. `this` is not %s %s.",d[f[0]],g));if(e=k(t),e===null||!I(e))throw new TypeError(s("invalid argument. First argument must be a supported byte order. Value: `%s`.",t));if(y=z(e),l=arguments.length,l>2){if(a=arguments[2],!c(a))throw new TypeError(s("invalid argument. Third argument must be a function. Value: `%s`.",a));l>3&&(n=arguments[3])}if(O(r)){if(a){for(T=r.length,r.get&&r.set?M=P("default"):M=S("default"),v=new this(e,T),m=v._buffer,p=0;p=r))return this._buffer[w](t*i,this._isLE)}),V(u.prototype,"buffer",function(){return this._buffer.buffer}),V(u.prototype,"byteLength",function(){return this._buffer.byteLength}),V(u.prototype,"byteOffset",function(){return this._buffer.byteOffset}),h(u.prototype,"BYTES_PER_ELEMENT",u.BYTES_PER_ELEMENT),h(u.prototype,"forEach",function(t,r){var n,e;if(!_(this))throw new TypeError(s("invalid invocation. `this` is not %s %s.",d[f[0]],g));if(!c(t))throw new TypeError(s("invalid argument. First argument must be a function. Value: `%s`.",t));for(n=this._buffer,e=0;e=this._length))return this._buffer[w](t*i,this._isLE)}),V(u.prototype,"length",function(){return this._length}),h(u.prototype,"set",function(t){var r,n,e,l,a,y,v,m;if(!_(this))throw new TypeError(s("invalid invocation. `this` is not %s %s.",d[f[0]],g));if(e=this._buffer,arguments.length>1){if(n=arguments[1],!q(n))throw new TypeError(s("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",n))}else n=0;if(O(t)){if(y=t.length,n+y>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=t,r.get&&r.set?a=P("default"):a=S("default"),m=e.byteOffset+n*i,r.buffer===e.buffer&&r.byteOffsetm){for(l=[],v=0;v=this._length)throw new RangeError(s("invalid argument. Index argument is out-of-bounds. Value: `%u`.",n));e[E](n*i,t,this._isLE)}),h(u.prototype,"toString",function(){var t,r,n;if(!_(this))throw new TypeError(s("invalid invocation. `this` is not %s %s.",d[f[0]],g));for(t=[],r=this._buffer,n=0;nr.byteLength-a)throw new RangeError(u("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",l));r=new T(r,a,l)}}return h(this,"_buffer",r),h(this,"_length",r.byteLength/i),h(this,"_isLE",n),this}return h(s,"BYTES_PER_ELEMENT",i),h(s,"name",v),h(s,"from",function(t,e){var n,r,l,o,y,g,m,L,M,_,p;if(!c(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!k(this))throw new TypeError(u("invalid invocation. `this` is not %s %s.",b[f[0]],v));if(r=F(t),r===null||!I(r))throw new TypeError(u("invalid argument. First argument must be a supported byte order. Value: `%s`.",t));if(y=z(r),l=arguments.length,l>2){if(o=arguments[2],!c(o))throw new TypeError(u("invalid argument. Third argument must be a function. Value: `%s`.",o));l>3&&(n=arguments[3])}if(O(e)){if(o){for(_=e.length,e.get&&e.set?M=P("default"):M=S("default"),g=new this(r,_),m=g._buffer,p=0;p<_;p++)m[w](p*i,o.call(n,M(e,p),p),y);return g}return new this(r,e)}if(U(e)&&H&&c(e[A])){if(m=e[A](),!c(m.next))throw new TypeError(u("invalid argument. Second argument must be an array-like object or an iterable. Value: `%s`.",e));for(o?L=ar(m,o,n):L=G(m),_=L.length,g=new this(r,_),m=g._buffer,p=0;p<_;p++)m[w](p*i,L[p],y);return g}throw new TypeError(u("invalid argument. Second argument must be an array-like object or an iterable. Value: `%s`.",e))}),h(s,"of",function(t){var e,n,r;if(!c(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!k(this))throw new TypeError(u("invalid invocation. `this` is not %s %s.",b[f[0]],v));if(e=F(t),e===null||!I(e))throw new TypeError(u("invalid argument. First argument must be a supported byte order. Value: `%s`.",t));for(n=[],r=1;r=e))return this._buffer[E](t*i,this._isLE)}),V(s.prototype,"buffer",function(){return this._buffer.buffer}),V(s.prototype,"byteLength",function(){return this._buffer.byteLength}),V(s.prototype,"byteOffset",function(){return this._buffer.byteOffset}),h(s.prototype,"BYTES_PER_ELEMENT",s.BYTES_PER_ELEMENT),h(s.prototype,"every",function(t,e){var n,r;if(!d(this))throw new TypeError(u("invalid invocation. `this` is not %s %s.",b[f[0]],v));if(!c(t))throw new TypeError(u("invalid argument. First argument must be a function. Value: `%s`.",t));for(n=this._buffer,r=0;r=this._length))return this._buffer[E](t*i,this._isLE)}),V(s.prototype,"length",function(){return this._length}),h(s.prototype,"set",function(t){var e,n,r,l,o,y,g,m;if(!d(this))throw new TypeError(u("invalid invocation. `this` is not %s %s.",b[f[0]],v));if(r=this._buffer,arguments.length>1){if(n=arguments[1],!q(n))throw new TypeError(u("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",n))}else n=0;if(O(t)){if(y=t.length,n+y>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(e=t,e.get&&e.set?o=P("default"):o=S("default"),m=r.byteOffset+n*i,e.buffer===r.buffer&&e.byteOffsetm){for(l=[],g=0;g=this._length)throw new RangeError(u("invalid argument. Index argument is out-of-bounds. Value: `%u`.",n));r[w](n*i,t,this._isLE)}),h(s.prototype,"toString",function(){var t,e,n;if(!d(this))throw new TypeError(u("invalid invocation. `this` is not %s %s.",b[f[0]],v));for(t=[],e=this._buffer,n=0;n\n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var arr = new Float64ArrayFE( 'little-endian', 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float64ArrayFE( 'little-endian', buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float64ArrayFE( 'little-endian', buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Float64ArrayFE( 'little-endian', buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction factory( dtype ) { // eslint-disable-line max-lines-per-function, stdlib/jsdoc-require-throws-tags\n\tvar BYTES_PER_ELEMENT;\n\tvar CTOR_NAME;\n\tvar GETTER;\n\tvar SETTER;\n\n\tif ( !isDataType( dtype ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a supported data type. Value: `%s`.', dtype ) );\n\t}\n\tBYTES_PER_ELEMENT = bytesPerElement( dtype );\n\tCTOR_NAME = dtype2ctor( dtype );\n\tGETTER = DTYPE2GET[ dtype ];\n\tSETTER = DTYPE2SET[ dtype ];\n\n\t/**\n\t* Typed array constructor which returns a typed array representing an array of values in a specified byte order.\n\t*\n\t* @private\n\t* @constructor\n\t* @param {string} endianness - byte order\n\t* @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or an iterable\n\t* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n\t* @param {NonNegativeInteger} [length] - view length\n\t* @throws {TypeError} first argument must be a supported byte order\n\t* @throws {TypeError} if provided only two arguments, the second argument must be a valid argument\n\t* @throws {TypeError} byte offset must be a nonnegative integer\n\t* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n\t* @returns {TypedArray} typed array instance\n\t*/\n\tfunction TypedArray() {\n\t\tvar byteOffset;\n\t\tvar endianness;\n\t\tvar nargs;\n\t\tvar isLE;\n\t\tvar buf;\n\t\tvar len;\n\t\tvar arg;\n\t\tvar tmp;\n\n\t\tnargs = arguments.length;\n\t\tif ( !(this instanceof TypedArray) ) {\n\t\t\tif ( nargs < 2 ) {\n\t\t\t\treturn new TypedArray( arguments[0] );\n\t\t\t}\n\t\t\tif ( nargs === 2 ) {\n\t\t\t\treturn new TypedArray( arguments[0], arguments[1] );\n\t\t\t}\n\t\t\tif ( nargs === 3 ) {\n\t\t\t\treturn new TypedArray( arguments[0], arguments[1], arguments[2] );\n\t\t\t}\n\t\t\treturn new TypedArray( arguments[0], arguments[1], arguments[2], arguments[3] );\n\t\t}\n\t\tendianness = byteOrder( arguments[ 0 ] );\n\t\tif ( endianness === null || !isByteOrder( endianness ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a supported byte order. Value: `%s`.', arguments[ 0 ] ) );\n\t\t}\n\t\tisLE = isLittleEndian( endianness );\n\n\t\tnargs -= 1;\n\n\t\t// Create the underlying data buffer...\n\t\tif ( nargs === 0 ) {\n\t\t\tbuf = new DataView( new ArrayBuffer( 0 ) ); // backward-compatibility\n\t\t} else if ( nargs === 1 ) {\n\t\t\targ = arguments[ nargs ];\n\t\t\tif ( isNonNegativeInteger( arg ) ) {\n\t\t\t\tbuf = new DataView( new ArrayBuffer( arg*BYTES_PER_ELEMENT ) );\n\t\t\t} else if ( isCollection( arg ) ) {\n\t\t\t\tbuf = fromArray( new DataView( new ArrayBuffer( arg.length*BYTES_PER_ELEMENT ) ), arg, isLE );\n\t\t\t} else if ( isArrayBuffer( arg ) ) {\n\t\t\t\tbuf = new DataView( arg );\n\t\t\t} else if ( isObject( arg ) ) {\n\t\t\t\tif ( HAS_ITERATOR_SYMBOL === false ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.', arg ) );\n\t\t\t\t}\n\t\t\t\tif ( !isFunction( arg[ ITERATOR_SYMBOL ] ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t\t}\n\t\t\t\tbuf = arg[ ITERATOR_SYMBOL ]();\n\t\t\t\tif ( !isFunction( buf.next ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t\t}\n\t\t\t\ttmp = fromIterator( buf );\n\t\t\t\tbuf = fromArray( new DataView( new ArrayBuffer( tmp.length*BYTES_PER_ELEMENT ) ), tmp, isLE );\n\t\t\t} else {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t}\n\t\t} else {\n\t\t\tbuf = arguments[ 1 ];\n\t\t\tif ( !isArrayBuffer( buf ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide an ArrayBuffer. Value: `%s`.', buf ) );\n\t\t\t}\n\t\t\tbyteOffset = arguments[ 2 ];\n\t\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.', byteOffset ) );\n\t\t\t}\n\t\t\tif ( nargs === 2 ) {\n\t\t\t\tbuf = new DataView( buf, byteOffset );\n\t\t\t} else {\n\t\t\t\tlen = arguments[ 3 ];\n\t\t\t\tif ( !isNonNegativeInteger( len ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Length must be a nonnegative integer. Value: `%s`.', len ) );\n\t\t\t\t}\n\t\t\t\tlen *= BYTES_PER_ELEMENT;\n\t\t\t\tif ( len > (buf.byteLength-byteOffset) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tbuf = new DataView( buf, byteOffset, len );\n\t\t\t}\n\t\t}\n\t\tsetReadOnly( this, '_buffer', buf );\n\t\tsetReadOnly( this, '_length', buf.byteLength/BYTES_PER_ELEMENT );\n\t\tsetReadOnly( this, '_isLE', isLE );\n\n\t\treturn this;\n\t}\n\n\t/**\n\t* Size (in bytes) of each array element.\n\t*\n\t* @private\n\t* @name BYTES_PER_ELEMENT\n\t* @memberof TypedArray\n\t* @readonly\n\t* @type {PositiveInteger}\n\t*/\n\tsetReadOnly( TypedArray, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n\t/**\n\t* Constructor name.\n\t*\n\t* @private\n\t* @name name\n\t* @memberof TypedArray\n\t* @readonly\n\t* @type {string}\n\t*/\n\tsetReadOnly( TypedArray, 'name', CTOR_NAME );\n\n\t/**\n\t* Creates a new typed array from an array-like object or an iterable.\n\t*\n\t* @private\n\t* @name from\n\t* @memberof TypedArray\n\t* @type {Function}\n\t* @param {string} endianness - byte order\n\t* @param {(Collection|Iterable)} src - array-like object or iterable\n\t* @param {Function} [clbk] - callback to invoke for each source element\n\t* @param {*} [thisArg] - context\n\t* @throws {TypeError} `this` context must be a constructor\n\t* @throws {TypeError} `this` must be a typed array constructor\n\t* @throws {TypeError} first argument must be a supported byte order\n\t* @throws {TypeError} second argument must be an array-like object or an iterable\n\t* @throws {TypeError} third argument must be a function\n\t* @returns {TypedArray} typed array instance\n\t*/\n\tsetReadOnly( TypedArray, 'from', function from( endianness, src ) {\n\t\tvar thisArg;\n\t\tvar order;\n\t\tvar nargs;\n\t\tvar clbk;\n\t\tvar isLE;\n\t\tvar out;\n\t\tvar buf;\n\t\tvar tmp;\n\t\tvar get;\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isFunction( this ) ) {\n\t\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t\t}\n\t\tif ( !isTypedArrayConstructor( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\torder = byteOrder( endianness );\n\t\tif ( order === null || !isByteOrder( order ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a supported byte order. Value: `%s`.', endianness ) );\n\t\t}\n\t\tisLE = isLittleEndian( order );\n\n\t\tnargs = arguments.length;\n\t\tif ( nargs > 2 ) {\n\t\t\tclbk = arguments[ 2 ];\n\t\t\tif ( !isFunction( clbk ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', clbk ) );\n\t\t\t}\n\t\t\tif ( nargs > 3 ) {\n\t\t\t\tthisArg = arguments[ 3 ];\n\t\t\t}\n\t\t}\n\t\tif ( isCollection( src ) ) {\n\t\t\tif ( clbk ) {\n\t\t\t\tlen = src.length;\n\t\t\t\tif ( src.get && src.set ) {\n\t\t\t\t\tget = accessorGetter( 'default' );\n\t\t\t\t} else {\n\t\t\t\t\tget = getter( 'default' );\n\t\t\t\t}\n\t\t\t\tout = new this( order, len );\n\t\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tbuf[ SETTER ]( i*BYTES_PER_ELEMENT, clbk.call( thisArg, get( src, i ), i ), isLE );\n\t\t\t\t}\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\treturn new this( order, src );\n\t\t}\n\t\tif ( isObject( src ) && HAS_ITERATOR_SYMBOL && isFunction( src[ ITERATOR_SYMBOL ] ) ) {\n\t\t\tbuf = src[ ITERATOR_SYMBOL ]();\n\t\t\tif ( !isFunction( buf.next ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n\t\t\t}\n\t\t\tif ( clbk ) {\n\t\t\t\ttmp = fromIteratorMap( buf, clbk, thisArg );\n\t\t\t} else {\n\t\t\t\ttmp = fromIterator( buf );\n\t\t\t}\n\t\t\tlen = tmp.length;\n\t\t\tout = new this( order, len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tbuf[ SETTER ]( i*BYTES_PER_ELEMENT, tmp[ i ], isLE );\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n\t});\n\n\t/**\n\t* Creates a new typed array from a variable number of arguments.\n\t*\n\t* @private\n\t* @name of\n\t* @memberof TypedArray\n\t* @type {Function}\n\t* @param {string} endianness - byte order\n\t* @param {...*} element - array elements\n\t* @throws {TypeError} `this` context must be a constructor\n\t* @throws {TypeError} `this` must be a typed array constructor\n\t* @throws {TypeError} first argument must be a supported byte order\n\t* @returns {TypedArray} typed array instance\n\t*/\n\tsetReadOnly( TypedArray, 'of', function of( endianness ) {\n\t\tvar order;\n\t\tvar args;\n\t\tvar i;\n\t\tif ( !isFunction( this ) ) {\n\t\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t\t}\n\t\tif ( !isTypedArrayConstructor( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\torder = byteOrder( endianness );\n\t\tif ( order === null || !isByteOrder( order ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a supported byte order. Value: `%s`.', endianness ) );\n\t\t}\n\t\targs = [];\n\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\targs.push( arguments[ i ] );\n\t\t}\n\t\treturn new this( order, args );\n\t});\n\n\t/**\n\t* Returns an array element located at integer position (index) `i`, with support for both nonnegative and negative integer indices.\n\t*\n\t* @private\n\t* @name at\n\t* @memberof TypedArray.prototype\n\t* @type {Function}\n\t* @param {integer} idx - element index\n\t* @throws {TypeError} `this` must be a typed array instance\n\t* @throws {TypeError} must provide an integer\n\t* @returns {(*|void)} array element\n\t*/\n\tsetReadOnly( TypedArray.prototype, 'at', function at( idx ) {\n\t\tvar len;\n\t\tif ( !isTypedArray( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\tif ( !isInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide an integer. Value: `%s`.', idx ) );\n\t\t}\n\t\tlen = this._length;\n\t\tif ( idx < 0 ) {\n\t\t\tidx += len;\n\t\t}\n\t\tif ( idx < 0 || idx >= len ) {\n\t\t\treturn;\n\t\t}\n\t\treturn this._buffer[ GETTER ]( idx * BYTES_PER_ELEMENT, this._isLE );\n\t});\n\n\t/**\n\t* Pointer to the underlying data buffer.\n\t*\n\t* @private\n\t* @name buffer\n\t* @memberof TypedArray.prototype\n\t* @readonly\n\t* @type {ArrayBuffer}\n\t*/\n\tsetReadOnlyAccessor( TypedArray.prototype, 'buffer', function get() {\n\t\treturn this._buffer.buffer;\n\t});\n\n\t/**\n\t* Size (in bytes) of the array.\n\t*\n\t* @private\n\t* @name byteLength\n\t* @memberof TypedArray.prototype\n\t* @readonly\n\t* @type {NonNegativeInteger}\n\t*/\n\tsetReadOnlyAccessor( TypedArray.prototype, 'byteLength', function get() {\n\t\treturn this._buffer.byteLength;\n\t});\n\n\t/**\n\t* Offset (in bytes) of the array from the start of its underlying `ArrayBuffer`.\n\t*\n\t* @private\n\t* @name byteOffset\n\t* @memberof TypedArray.prototype\n\t* @readonly\n\t* @type {NonNegativeInteger}\n\t*/\n\tsetReadOnlyAccessor( TypedArray.prototype, 'byteOffset', function get() {\n\t\treturn this._buffer.byteOffset;\n\t});\n\n\t/**\n\t* Size (in bytes) of each array element.\n\t*\n\t* @private\n\t* @name BYTES_PER_ELEMENT\n\t* @memberof TypedArray.prototype\n\t* @readonly\n\t* @type {PositiveInteger}\n\t*/\n\tsetReadOnly( TypedArray.prototype, 'BYTES_PER_ELEMENT', TypedArray.BYTES_PER_ELEMENT );\n\n\t/**\n\t* Invokes a function once for each array element.\n\t*\n\t* @name forEach\n\t* @memberof TypedArray.prototype\n\t* @type {Function}\n\t* @param {Function} fcn - function to invoke\n\t* @param {*} [thisArg] - function invocation context\n\t* @throws {TypeError} `this` must be a typed array instance\n\t* @throws {TypeError} first argument must be a function\n\t*/\n\tsetReadOnly( TypedArray.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\t\tvar buf;\n\t\tvar i;\n\n\t\tif ( !isTypedArray( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\tif ( !isFunction( fcn ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t\t}\n\t\tbuf = this._buffer;\n\t\tfor ( i = 0; i < this._length; i++ ) {\n\t\t\tfcn.call( thisArg, buf[ GETTER ]( i*BYTES_PER_ELEMENT, this._isLE ), i, this );\n\t\t}\n\t});\n\n\t/**\n\t* Returns an array element.\n\t*\n\t* @private\n\t* @name get\n\t* @memberof TypedArray.prototype\n\t* @type {Function}\n\t* @param {NonNegativeInteger} idx - element index\n\t* @throws {TypeError} `this` must be a typed array instance\n\t* @throws {TypeError} must provide a nonnegative integer\n\t* @returns {(*|void)} array element\n\t*/\n\tsetReadOnly( TypedArray.prototype, 'get', function get( idx ) {\n\t\tif ( !isTypedArray( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\tif ( !isNonNegativeInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', idx ) );\n\t\t}\n\t\tif ( idx >= this._length ) {\n\t\t\treturn;\n\t\t}\n\t\treturn this._buffer[ GETTER ]( idx*BYTES_PER_ELEMENT, this._isLE );\n\t});\n\n\t/**\n\t* Number of array elements.\n\t*\n\t* @private\n\t* @name length\n\t* @memberof TypedArray.prototype\n\t* @readonly\n\t* @type {NonNegativeInteger}\n\t*/\n\tsetReadOnlyAccessor( TypedArray.prototype, 'length', function get() {\n\t\treturn this._length;\n\t});\n\n\t/**\n\t* Sets an array element.\n\t*\n\t* ## Notes\n\t*\n\t* - When provided a typed array, we must check whether the source array shares the same buffer as the target array and whether the underlying memory overlaps. In particular, we are concerned with the following scenario:\n\t*\n\t* ```text\n\t* buf: ---------------------\n\t* src: ---------------------\n\t* ```\n\t*\n\t* In the above, as we copy values from `src`, we will overwrite values in the `src` view, resulting in duplicated values copied into the end of `buf`, which is not intended. Hence, to avoid overwriting source values, we must **copy** source values to a temporary array.\n\t*\n\t* In the other overlapping scenario,\n\t*\n\t* ```text\n\t* buf: ---------------------\n\t* src: ---------------------\n\t* ```\n\t*\n\t* by the time we begin copying into the overlapping region, we are copying from the end of `src`, a non-overlapping region, which means we don't run the risk of copying copied values, rather than the original `src` values, as intended.\n\t*\n\t* @private\n\t* @name set\n\t* @memberof TypedArray.prototype\n\t* @type {Function}\n\t* @param {(Collection|TypedArray|*)} value - value(s)\n\t* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n\t* @throws {TypeError} `this` must be a typed array instance\n\t* @throws {TypeError} index argument must be a nonnegative integer\n\t* @throws {RangeError} index argument is out-of-bounds\n\t* @throws {RangeError} target array lacks sufficient storage to accommodate source values\n\t* @returns {void}\n\t*/\n\tsetReadOnly( TypedArray.prototype, 'set', function set( value ) {\n\t\tvar sbuf;\n\t\tvar idx;\n\t\tvar buf;\n\t\tvar tmp;\n\t\tvar get;\n\t\tvar N;\n\t\tvar i;\n\t\tvar j;\n\t\tif ( !isTypedArray( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\tbuf = this._buffer;\n\t\tif ( arguments.length > 1 ) {\n\t\t\tidx = arguments[ 1 ];\n\t\t\tif ( !isNonNegativeInteger( idx ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Index argument must be a nonnegative integer. Value: `%s`.', idx ) );\n\t\t\t}\n\t\t} else {\n\t\t\tidx = 0;\n\t\t}\n\t\tif ( isCollection( value ) ) {\n\t\t\tN = value.length;\n\t\t\tif ( idx+N > this._length ) {\n\t\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t\t}\n\t\t\tsbuf = value;\n\t\t\tif ( sbuf.get && sbuf.set ) {\n\t\t\t\tget = accessorGetter( 'default' );\n\t\t\t} else {\n\t\t\t\tget = getter( 'default' );\n\t\t\t}\n\t\t\t// Check for overlapping memory...\n\t\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\t\tif (\n\t\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t\t(\n\t\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// We need to copy source values...\n\t\t\t\ttmp = [];\n\t\t\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\t\t\ttmp.push( get( value, i ) );\n\t\t\t\t}\n\t\t\t\tsbuf = tmp;\n\t\t\t\tget = getter( 'default' );\n\t\t\t}\n\t\t\tfor ( i = 0; i < N; idx++, i++ ) {\n\t\t\t\tbuf[ SETTER ]( idx*BYTES_PER_ELEMENT, get( sbuf, i ), this._isLE );\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif ( idx >= this._length ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%u`.', idx ) );\n\t\t}\n\t\tbuf[ SETTER ]( idx*BYTES_PER_ELEMENT, value, this._isLE );\n\t});\n\n\t/**\n\t* Serializes an array as a string.\n\t*\n\t* @private\n\t* @name toString\n\t* @memberof TypedArray.prototype\n\t* @type {Function}\n\t* @throws {TypeError} `this` must be a typed array instance\n\t* @returns {string} string representation\n\t*/\n\tsetReadOnly( TypedArray.prototype, 'toString', function toString() {\n\t\tvar out;\n\t\tvar buf;\n\t\tvar i;\n\t\tif ( !isTypedArray( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\tout = [];\n\t\tbuf = this._buffer;\n\t\tfor ( i = 0; i < this._length; i++ ) {\n\t\t\tout.push( buf[ GETTER ]( i*BYTES_PER_ELEMENT, this._isLE ) );\n\t\t}\n\t\treturn out.join( ',' );\n\t});\n\n\treturn TypedArray;\n\n\t/**\n\t* Returns a boolean indicating if a value is a typed array constructor.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating if a value is a typed array constructor\n\t*/\n\tfunction isTypedArrayConstructor( value ) {\n\t\treturn ( value === TypedArray );\n\t}\n\n\t/**\n\t* Returns a boolean indicating if a value is a typed array.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating if a value is a typed array\n\t*/\n\tfunction isTypedArray( value ) {\n\t\treturn (\n\t\t\ttypeof value === 'object' &&\n\t\t\tvalue !== null &&\n\t\t\t(\n\t\t\t\tvalue.constructor.name === CTOR_NAME ||\n\t\t\t\tisPrototypeOf( value, TypedArray.prototype )\n\t\t\t) &&\n\t\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t\t);\n\t}\n\n\t/**\n\t* Fills an output DataView with array values.\n\t*\n\t* @private\n\t* @param {DataView} view - output data view\n\t* @param {Array} arr - input array\n\t* @param {boolean} isLE - boolean indicating whether to store values in little-endian byte order\n\t* @returns {DataView} output data view\n\t*/\n\tfunction fromArray( view, arr, isLE ) {\n\t\tvar len;\n\t\tvar get;\n\t\tvar i;\n\n\t\tlen = arr.length;\n\t\tif ( arr.get && arr.set ) {\n\t\t\tget = accessorGetter( 'default' );\n\t\t} else {\n\t\t\tget = getter( 'default' );\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tview[ SETTER ]( i*BYTES_PER_ELEMENT, get( arr, i ), isLE );\n\t\t}\n\t\treturn view;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Return a typed array constructor for creating typed arrays having a specified byte order.\n*\n* @module @stdlib/array-fixed-endian-factory\n*\n* @example\n* var factory = require( '@stdlib/array-fixed-endian-factory' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var arr = new Float64ArrayFE( 'little-endian' );\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var factory = require( '@stdlib/array-fixed-endian-factory' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var arr = new Float64ArrayFE( 'little-endian', 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var factory = require( '@stdlib/array-fixed-endian-factory' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var arr = new Float64ArrayFE( 'little-endian', [ 1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var factory = require( '@stdlib/array-fixed-endian-factory' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float64ArrayFE( 'little-endian', buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var factory = require( '@stdlib/array-fixed-endian-factory' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float64ArrayFE( 'little-endian', buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var factory = require( '@stdlib/array-fixed-endian-factory' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Float64ArrayFE( 'little-endian', buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cA6BA,SAASC,EAAcC,EAAK,CAC3B,IAAIC,EACAC,EAGJ,IADAD,EAAM,CAAC,EAENC,EAAIF,EAAG,KAAK,EACP,CAAAE,EAAE,MAGPD,EAAI,KAAMC,EAAE,KAAM,EAEnB,OAAOD,CACR,CAKAH,EAAO,QAAUC,IC/CjB,IAAAI,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cA+BA,SAASC,EAAiBC,EAAIC,EAAMC,EAAU,CAC7C,IAAIC,EACAC,EACAC,EAIJ,IAFAF,EAAM,CAAC,EACPE,EAAI,GAEHD,EAAIJ,EAAG,KAAK,EACP,CAAAI,EAAE,MAGPC,GAAK,EACLF,EAAI,KAAMF,EAAK,KAAMC,EAASE,EAAE,MAAOC,CAAE,CAAE,EAE5C,OAAOF,CACR,CAKAL,EAAO,QAAUC,ICpDjB,IAAAO,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cAwBA,IAAIC,EAAuB,QAAS,uCAAwC,EAAE,YAC1EC,EAAY,QAAS,2BAA4B,EAAE,YACnDC,EAAe,QAAS,8BAA+B,EACvDC,EAAgB,QAAS,+BAAgC,EACzDC,EAAW,QAAS,0BAA2B,EAC/CC,EAAa,QAAS,4BAA6B,EACnDC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAc,QAAS,yCAA0C,EACjEC,EAAY,QAAS,+BAAgC,EACrDC,GAA2B,QAAS,4CAA6C,EACjFC,EAAkB,QAAS,yBAA0B,EACrDC,EAAc,QAAS,uDAAwD,EAC/EC,GAAgB,QAAS,gCAAiC,EAC1DC,EAAsB,QAAS,uDAAwD,EACvFC,EAAc,Q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,EACJ,GAAK,CAACI,EAAc,IAAK,EACxB,MAAM,IAAI,UAAWvC,EAAQ,2CAA4CO,EAAcM,EAAM,CAAC,CAAE,EAAGG,CAAU,CAAE,EAIhH,IAFAiB,EAAM,CAAC,EACPT,EAAM,KAAK,QACLW,EAAI,EAAGA,EAAI,KAAK,QAASA,IAC9BF,EAAI,KAAMT,EAAKP,CAAO,EAAGkB,EAAEpB,EAAmB,KAAK,KAAM,CAAE,EAE5D,OAAOkB,EAAI,KAAM,GAAI,CACtB,CAAC,EAEMd,EASP,SAASiB,EAAyB1B,EAAQ,CACzC,OAASA,IAAUS,CACpB,CASA,SAASoB,EAAc7B,EAAQ,CAC9B,OACC,OAAOA,GAAU,UACjBA,IAAU,OAETA,EAAM,YAAY,OAASM,GAC3BzB,GAAemB,EAAOS,EAAW,SAAU,IAE5CT,EAAM,oBAAsBK,CAE9B,CAWA,SAASa,EAAWgB,EAAMC,EAAKtB,EAAO,CACrC,IAAIE,EACAS,EACAC,EAQJ,IANAV,EAAMoB,EAAI,OACLA,EAAI,KAAOA,EAAI,IACnBX,EAAMtC,EAAgB,SAAU,EAEhCsC,EAAMvC,EAAQ,SAAU,EAEnBwC,EAAI,EAAGA,EAAIV,EAAKU,IACrBS,EAAM1B,CAAO,EAAGiB,EAAEpB,EAAmBmB,EAAKW,EAAKV,CAAE,EAAGZ,CAAK,EAE1D,OAAOqB,CACR,CACD,CAKAlE,EAAO,QAAUoC,KC/qBjB,IAAIgC,GAAO,IAKX,OAAO,QAAUA", - "names": ["require_from_iterator", "__commonJSMin", "exports", "module", "fromIterator", "it", "out", "v", "require_from_iterator_map", "__commonJSMin", "exports", "module", "fromIteratorMap", "it", "clbk", "thisArg", "out", "v", "i", "require_main", "__commonJSMin", "exports", "module", "isNonNegativeInteger", "isInteger", "isCollection", "isArrayBuffer", "isObject", "isFunction", "isString", "isByteOrder", "lowercase", "hasIteratorSymbolSupport", "ITERATOR_SYMBOL", "setReadOnly", "isPrototypeOf", "setReadOnlyAccessor", "ArrayBuffer", "DataView", "getter", "accessorGetter", "contains", "bytesPerElement", "capitalize", "format", "fromIterator", "fromIteratorMap", "HAS_ITERATOR_SYMBOL", "DTYPES", "DTYPE2SET", "DTYPE2GET", "CHAR2ARTICLE", "isDataType", "byteOrder", "value", "isLittleEndian", "dtype2ctor", "dtype", "factory", "BYTES_PER_ELEMENT", "CTOR_NAME", "GETTER", "SETTER", "TypedArray", "byteOffset", "endianness", "nargs", "isLE", "buf", "len", "arg", "tmp", "fromArray", "src", "thisArg", "order", "clbk", "out", "get", "i", "isTypedArrayConstructor", "args", "idx", "isTypedArray", "fcn", "sbuf", "N", "j", "view", "arr", "main"] + "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {Array} output array\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\n\tout = [];\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\tout.push( v.value );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromIterator;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @param {Function} clbk - callback to invoke for each iterated value\n* @param {*} thisArg - invocation context\n* @returns {Array} output array\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar i;\n\n\tout = [];\n\ti = -1;\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\ti += 1;\n\t\tout.push( clbk.call( thisArg, v.value, i ) );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromIteratorMap;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable max-len, no-restricted-syntax, no-invalid-this, max-lines */\n\n'use strict';\n\n// MODULES //\n\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' );\nvar isObject = require( '@stdlib/assert-is-object' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isByteOrder = require( '@stdlib/array-base-assert-is-byte-order' );\nvar lowercase = require( '@stdlib/string-base-lowercase' );\nvar hasIteratorSymbolSupport = require( '@stdlib/assert-has-iterator-symbol-support' );\nvar ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' );\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isPrototypeOf = require( '@stdlib/assert-is-prototype-of' ); // eslint-disable-line stdlib/no-redeclare\nvar setReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' );\nvar ArrayBuffer = require( '@stdlib/array-buffer' );\nvar DataView = require( '@stdlib/array-dataview' );\nvar getter = require( '@stdlib/array-base-getter' );\nvar accessorGetter = require( '@stdlib/array-base-accessor-getter' );\nvar contains = require( '@stdlib/array-base-assert-contains' ).factory;\nvar bytesPerElement = require( '@stdlib/ndarray-base-bytes-per-element' );\nvar capitalize = require( '@stdlib/string-base-capitalize' );\nvar format = require( '@stdlib/string-format' );\nvar fromIterator = require( './from_iterator.js' );\nvar fromIteratorMap = require( './from_iterator_map.js' );\n\n\n// VARIABLES //\n\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\nvar DTYPES = [ 'float64', 'float32', 'int32', 'int16', 'uint32', 'uint16' ];\nvar DTYPE2SET = {\n\t'float64': 'setFloat64',\n\t'float32': 'setFloat32',\n\t'int32': 'setInt32',\n\t'int16': 'setInt16',\n\t'uint32': 'setUint32',\n\t'uint16': 'setUint16'\n};\nvar DTYPE2GET = {\n\t'float64': 'getFloat64',\n\t'float32': 'getFloat32',\n\t'int32': 'getInt32',\n\t'int16': 'getInt16',\n\t'uint32': 'getUint32',\n\t'uint16': 'getUint16'\n};\nvar CHAR2ARTICLE = {\n\t'c': 'a',\n\t'f': 'a',\n\t'i': 'an',\n\t'u': 'a',\n\t'b': 'a'\n};\nvar isDataType = contains( DTYPES );\n\n\n// FUNCTIONS //\n\n/**\n* Normalizes a byte order value.\n*\n* @private\n* @param {*} value - byte order\n* @returns {(string|null)} normalized byte order\n*/\nfunction byteOrder( value ) {\n\treturn ( isString( value ) ) ? lowercase( value ) : null;\n}\n\n/**\n* Tests whether a provided byte order is little-endian byte order.\n*\n* @private\n* @param {string} value - byte order\n* @returns {boolean} boolean indicating whether a byte order is little-endian byte order\n*/\nfunction isLittleEndian( value ) {\n\treturn ( value === 'little-endian' );\n}\n\n/**\n* Converts a data type string to a constructor name.\n*\n* @private\n* @param {string} dtype - data type\n* @returns {string} constructor name\n*\n* @example\n* var n = dtype2ctor( 'float64' );\n* // returns 'Float64ArrayFE'\n*\n* @example\n* var n = dtype2ctor( 'int32' );\n* // returns 'Int32ArrayFE'\n*/\nfunction dtype2ctor( dtype ) {\n\treturn capitalize( dtype ) + 'ArrayFE';\n}\n\n\n// MAIN //\n\n/**\n* Returns a typed array constructor for creating typed arrays having a specified byte order.\n*\n* @param {string} dtype - typed array data type\n* @throws {TypeError} first argument must be a supported data type\n* @returns {Function} typed array constructor\n*\n* @example\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var arr = new Float64ArrayFE( 'little-endian' );\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var arr = new Float64ArrayFE( 'little-endian', 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float64ArrayFE( 'little-endian', buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float64ArrayFE( 'little-endian', buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Float64ArrayFE( 'little-endian', buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction factory( dtype ) { // eslint-disable-line max-lines-per-function, stdlib/jsdoc-require-throws-tags\n\tvar BYTES_PER_ELEMENT;\n\tvar CTOR_NAME;\n\tvar GETTER;\n\tvar SETTER;\n\n\tif ( !isDataType( dtype ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a supported data type. Value: `%s`.', dtype ) );\n\t}\n\tBYTES_PER_ELEMENT = bytesPerElement( dtype );\n\tCTOR_NAME = dtype2ctor( dtype );\n\tGETTER = DTYPE2GET[ dtype ];\n\tSETTER = DTYPE2SET[ dtype ];\n\n\t/**\n\t* Typed array constructor which returns a typed array representing an array of values in a specified byte order.\n\t*\n\t* @private\n\t* @constructor\n\t* @param {string} endianness - byte order\n\t* @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or an iterable\n\t* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n\t* @param {NonNegativeInteger} [length] - view length\n\t* @throws {TypeError} first argument must be a supported byte order\n\t* @throws {TypeError} if provided only two arguments, the second argument must be a valid argument\n\t* @throws {TypeError} byte offset must be a nonnegative integer\n\t* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n\t* @returns {TypedArray} typed array instance\n\t*/\n\tfunction TypedArray() {\n\t\tvar byteOffset;\n\t\tvar endianness;\n\t\tvar nargs;\n\t\tvar isLE;\n\t\tvar buf;\n\t\tvar len;\n\t\tvar arg;\n\t\tvar tmp;\n\n\t\tnargs = arguments.length;\n\t\tif ( !(this instanceof TypedArray) ) {\n\t\t\tif ( nargs < 2 ) {\n\t\t\t\treturn new TypedArray( arguments[0] );\n\t\t\t}\n\t\t\tif ( nargs === 2 ) {\n\t\t\t\treturn new TypedArray( arguments[0], arguments[1] );\n\t\t\t}\n\t\t\tif ( nargs === 3 ) {\n\t\t\t\treturn new TypedArray( arguments[0], arguments[1], arguments[2] );\n\t\t\t}\n\t\t\treturn new TypedArray( arguments[0], arguments[1], arguments[2], arguments[3] );\n\t\t}\n\t\tendianness = byteOrder( arguments[ 0 ] );\n\t\tif ( endianness === null || !isByteOrder( endianness ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a supported byte order. Value: `%s`.', arguments[ 0 ] ) );\n\t\t}\n\t\tisLE = isLittleEndian( endianness );\n\n\t\tnargs -= 1;\n\n\t\t// Create the underlying data buffer...\n\t\tif ( nargs === 0 ) {\n\t\t\tbuf = new DataView( new ArrayBuffer( 0 ) ); // backward-compatibility\n\t\t} else if ( nargs === 1 ) {\n\t\t\targ = arguments[ nargs ];\n\t\t\tif ( isNonNegativeInteger( arg ) ) {\n\t\t\t\tbuf = new DataView( new ArrayBuffer( arg*BYTES_PER_ELEMENT ) );\n\t\t\t} else if ( isCollection( arg ) ) {\n\t\t\t\tbuf = fromArray( new DataView( new ArrayBuffer( arg.length*BYTES_PER_ELEMENT ) ), arg, isLE );\n\t\t\t} else if ( isArrayBuffer( arg ) ) {\n\t\t\t\tbuf = new DataView( arg );\n\t\t\t} else if ( isObject( arg ) ) {\n\t\t\t\tif ( HAS_ITERATOR_SYMBOL === false ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Environment lacks Symbol.iterator support. Must provide a length, ArrayBuffer, typed array, or array-like object. Value: `%s`.', arg ) );\n\t\t\t\t}\n\t\t\t\tif ( !isFunction( arg[ ITERATOR_SYMBOL ] ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t\t}\n\t\t\t\tbuf = arg[ ITERATOR_SYMBOL ]();\n\t\t\t\tif ( !isFunction( buf.next ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t\t}\n\t\t\t\ttmp = fromIterator( buf );\n\t\t\t\tbuf = fromArray( new DataView( new ArrayBuffer( tmp.length*BYTES_PER_ELEMENT ) ), tmp, isLE );\n\t\t\t} else {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, ArrayBuffer, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t}\n\t\t} else {\n\t\t\tbuf = arguments[ 1 ];\n\t\t\tif ( !isArrayBuffer( buf ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide an ArrayBuffer. Value: `%s`.', buf ) );\n\t\t\t}\n\t\t\tbyteOffset = arguments[ 2 ];\n\t\t\tif ( !isNonNegativeInteger( byteOffset ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Byte offset must be a nonnegative integer. Value: `%s`.', byteOffset ) );\n\t\t\t}\n\t\t\tif ( nargs === 2 ) {\n\t\t\t\tbuf = new DataView( buf, byteOffset );\n\t\t\t} else {\n\t\t\t\tlen = arguments[ 3 ];\n\t\t\t\tif ( !isNonNegativeInteger( len ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Length must be a nonnegative integer. Value: `%s`.', len ) );\n\t\t\t\t}\n\t\t\t\tlen *= BYTES_PER_ELEMENT;\n\t\t\t\tif ( len > (buf.byteLength-byteOffset) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tbuf = new DataView( buf, byteOffset, len );\n\t\t\t}\n\t\t}\n\t\tsetReadOnly( this, '_buffer', buf );\n\t\tsetReadOnly( this, '_length', buf.byteLength/BYTES_PER_ELEMENT );\n\t\tsetReadOnly( this, '_isLE', isLE );\n\n\t\treturn this;\n\t}\n\n\t/**\n\t* Size (in bytes) of each array element.\n\t*\n\t* @private\n\t* @name BYTES_PER_ELEMENT\n\t* @memberof TypedArray\n\t* @readonly\n\t* @type {PositiveInteger}\n\t*/\n\tsetReadOnly( TypedArray, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n\t/**\n\t* Constructor name.\n\t*\n\t* @private\n\t* @name name\n\t* @memberof TypedArray\n\t* @readonly\n\t* @type {string}\n\t*/\n\tsetReadOnly( TypedArray, 'name', CTOR_NAME );\n\n\t/**\n\t* Creates a new typed array from an array-like object or an iterable.\n\t*\n\t* @private\n\t* @name from\n\t* @memberof TypedArray\n\t* @type {Function}\n\t* @param {string} endianness - byte order\n\t* @param {(Collection|Iterable)} src - array-like object or iterable\n\t* @param {Function} [clbk] - callback to invoke for each source element\n\t* @param {*} [thisArg] - context\n\t* @throws {TypeError} `this` context must be a constructor\n\t* @throws {TypeError} `this` must be a typed array constructor\n\t* @throws {TypeError} first argument must be a supported byte order\n\t* @throws {TypeError} second argument must be an array-like object or an iterable\n\t* @throws {TypeError} third argument must be a function\n\t* @returns {TypedArray} typed array instance\n\t*/\n\tsetReadOnly( TypedArray, 'from', function from( endianness, src ) {\n\t\tvar thisArg;\n\t\tvar order;\n\t\tvar nargs;\n\t\tvar clbk;\n\t\tvar isLE;\n\t\tvar out;\n\t\tvar buf;\n\t\tvar tmp;\n\t\tvar get;\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isFunction( this ) ) {\n\t\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t\t}\n\t\tif ( !isTypedArrayConstructor( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\torder = byteOrder( endianness );\n\t\tif ( order === null || !isByteOrder( order ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a supported byte order. Value: `%s`.', endianness ) );\n\t\t}\n\t\tisLE = isLittleEndian( order );\n\n\t\tnargs = arguments.length;\n\t\tif ( nargs > 2 ) {\n\t\t\tclbk = arguments[ 2 ];\n\t\t\tif ( !isFunction( clbk ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', clbk ) );\n\t\t\t}\n\t\t\tif ( nargs > 3 ) {\n\t\t\t\tthisArg = arguments[ 3 ];\n\t\t\t}\n\t\t}\n\t\tif ( isCollection( src ) ) {\n\t\t\tif ( clbk ) {\n\t\t\t\tlen = src.length;\n\t\t\t\tif ( src.get && src.set ) {\n\t\t\t\t\tget = accessorGetter( 'default' );\n\t\t\t\t} else {\n\t\t\t\t\tget = getter( 'default' );\n\t\t\t\t}\n\t\t\t\tout = new this( order, len );\n\t\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tbuf[ SETTER ]( i*BYTES_PER_ELEMENT, clbk.call( thisArg, get( src, i ), i ), isLE );\n\t\t\t\t}\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\treturn new this( order, src );\n\t\t}\n\t\tif ( isObject( src ) && HAS_ITERATOR_SYMBOL && isFunction( src[ ITERATOR_SYMBOL ] ) ) {\n\t\t\tbuf = src[ ITERATOR_SYMBOL ]();\n\t\t\tif ( !isFunction( buf.next ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n\t\t\t}\n\t\t\tif ( clbk ) {\n\t\t\t\ttmp = fromIteratorMap( buf, clbk, thisArg );\n\t\t\t} else {\n\t\t\t\ttmp = fromIterator( buf );\n\t\t\t}\n\t\t\tlen = tmp.length;\n\t\t\tout = new this( order, len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tbuf[ SETTER ]( i*BYTES_PER_ELEMENT, tmp[ i ], isLE );\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an array-like object or an iterable. Value: `%s`.', src ) );\n\t});\n\n\t/**\n\t* Creates a new typed array from a variable number of arguments.\n\t*\n\t* @private\n\t* @name of\n\t* @memberof TypedArray\n\t* @type {Function}\n\t* @param {string} endianness - byte order\n\t* @param {...*} element - array elements\n\t* @throws {TypeError} `this` context must be a constructor\n\t* @throws {TypeError} `this` must be a typed array constructor\n\t* @throws {TypeError} first argument must be a supported byte order\n\t* @returns {TypedArray} typed array instance\n\t*/\n\tsetReadOnly( TypedArray, 'of', function of( endianness ) {\n\t\tvar order;\n\t\tvar args;\n\t\tvar i;\n\t\tif ( !isFunction( this ) ) {\n\t\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t\t}\n\t\tif ( !isTypedArrayConstructor( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\torder = byteOrder( endianness );\n\t\tif ( order === null || !isByteOrder( order ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a supported byte order. Value: `%s`.', endianness ) );\n\t\t}\n\t\targs = [];\n\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\targs.push( arguments[ i ] );\n\t\t}\n\t\treturn new this( order, args );\n\t});\n\n\t/**\n\t* Returns an array element located at integer position (index) `i`, with support for both nonnegative and negative integer indices.\n\t*\n\t* @private\n\t* @name at\n\t* @memberof TypedArray.prototype\n\t* @type {Function}\n\t* @param {integer} idx - element index\n\t* @throws {TypeError} `this` must be a typed array instance\n\t* @throws {TypeError} must provide an integer\n\t* @returns {(*|void)} array element\n\t*/\n\tsetReadOnly( TypedArray.prototype, 'at', function at( idx ) {\n\t\tvar len;\n\t\tif ( !isTypedArray( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\tif ( !isInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide an integer. Value: `%s`.', idx ) );\n\t\t}\n\t\tlen = this._length;\n\t\tif ( idx < 0 ) {\n\t\t\tidx += len;\n\t\t}\n\t\tif ( idx < 0 || idx >= len ) {\n\t\t\treturn;\n\t\t}\n\t\treturn this._buffer[ GETTER ]( idx * BYTES_PER_ELEMENT, this._isLE );\n\t});\n\n\t/**\n\t* Pointer to the underlying data buffer.\n\t*\n\t* @private\n\t* @name buffer\n\t* @memberof TypedArray.prototype\n\t* @readonly\n\t* @type {ArrayBuffer}\n\t*/\n\tsetReadOnlyAccessor( TypedArray.prototype, 'buffer', function get() {\n\t\treturn this._buffer.buffer;\n\t});\n\n\t/**\n\t* Size (in bytes) of the array.\n\t*\n\t* @private\n\t* @name byteLength\n\t* @memberof TypedArray.prototype\n\t* @readonly\n\t* @type {NonNegativeInteger}\n\t*/\n\tsetReadOnlyAccessor( TypedArray.prototype, 'byteLength', function get() {\n\t\treturn this._buffer.byteLength;\n\t});\n\n\t/**\n\t* Offset (in bytes) of the array from the start of its underlying `ArrayBuffer`.\n\t*\n\t* @private\n\t* @name byteOffset\n\t* @memberof TypedArray.prototype\n\t* @readonly\n\t* @type {NonNegativeInteger}\n\t*/\n\tsetReadOnlyAccessor( TypedArray.prototype, 'byteOffset', function get() {\n\t\treturn this._buffer.byteOffset;\n\t});\n\n\t/**\n\t* Size (in bytes) of each array element.\n\t*\n\t* @private\n\t* @name BYTES_PER_ELEMENT\n\t* @memberof TypedArray.prototype\n\t* @readonly\n\t* @type {PositiveInteger}\n\t*/\n\tsetReadOnly( TypedArray.prototype, 'BYTES_PER_ELEMENT', TypedArray.BYTES_PER_ELEMENT );\n\n\t/**\n\t* Tests whether all elements in an array pass a test implemented by a predicate function.\n\t*\n\t* @name every\n\t* @memberof TypedArray.prototype\n\t* @type {Function}\n\t* @param {Function} predicate - predicate function\n\t* @param {*} [thisArg] - function invocation context\n\t* @throws {TypeError} `this` must be a typed array instance\n\t* @throws {TypeError} first argument must be a function\n\t* @returns {boolean} boolean indicating whether all elements pass a test\n\t*/\n\tsetReadOnly( TypedArray.prototype, 'every', function every( predicate, thisArg ) {\n\t\tvar buf;\n\t\tvar i;\n\n\t\tif ( !isTypedArray( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\tif ( !isFunction( predicate ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t\t}\n\t\tbuf = this._buffer;\n\t\tfor ( i = 0; i < this._length; i++ ) {\n\t\t\tif ( !predicate.call( thisArg, buf[ GETTER ]( i * BYTES_PER_ELEMENT, this._isLE ), i, this ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t});\n\n\t/**\n\t* Invokes a function once for each array element.\n\t*\n\t* @name forEach\n\t* @memberof TypedArray.prototype\n\t* @type {Function}\n\t* @param {Function} fcn - function to invoke\n\t* @param {*} [thisArg] - function invocation context\n\t* @throws {TypeError} `this` must be a typed array instance\n\t* @throws {TypeError} first argument must be a function\n\t*/\n\tsetReadOnly( TypedArray.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\t\tvar buf;\n\t\tvar i;\n\n\t\tif ( !isTypedArray( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\tif ( !isFunction( fcn ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) );\n\t\t}\n\t\tbuf = this._buffer;\n\t\tfor ( i = 0; i < this._length; i++ ) {\n\t\t\tfcn.call( thisArg, buf[ GETTER ]( i*BYTES_PER_ELEMENT, this._isLE ), i, this );\n\t\t}\n\t});\n\n\t/**\n\t* Returns an array element.\n\t*\n\t* @private\n\t* @name get\n\t* @memberof TypedArray.prototype\n\t* @type {Function}\n\t* @param {NonNegativeInteger} idx - element index\n\t* @throws {TypeError} `this` must be a typed array instance\n\t* @throws {TypeError} must provide a nonnegative integer\n\t* @returns {(*|void)} array element\n\t*/\n\tsetReadOnly( TypedArray.prototype, 'get', function get( idx ) {\n\t\tif ( !isTypedArray( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\tif ( !isNonNegativeInteger( idx ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', idx ) );\n\t\t}\n\t\tif ( idx >= this._length ) {\n\t\t\treturn;\n\t\t}\n\t\treturn this._buffer[ GETTER ]( idx*BYTES_PER_ELEMENT, this._isLE );\n\t});\n\n\t/**\n\t* Number of array elements.\n\t*\n\t* @private\n\t* @name length\n\t* @memberof TypedArray.prototype\n\t* @readonly\n\t* @type {NonNegativeInteger}\n\t*/\n\tsetReadOnlyAccessor( TypedArray.prototype, 'length', function get() {\n\t\treturn this._length;\n\t});\n\n\t/**\n\t* Sets an array element.\n\t*\n\t* ## Notes\n\t*\n\t* - When provided a typed array, we must check whether the source array shares the same buffer as the target array and whether the underlying memory overlaps. In particular, we are concerned with the following scenario:\n\t*\n\t* ```text\n\t* buf: ---------------------\n\t* src: ---------------------\n\t* ```\n\t*\n\t* In the above, as we copy values from `src`, we will overwrite values in the `src` view, resulting in duplicated values copied into the end of `buf`, which is not intended. Hence, to avoid overwriting source values, we must **copy** source values to a temporary array.\n\t*\n\t* In the other overlapping scenario,\n\t*\n\t* ```text\n\t* buf: ---------------------\n\t* src: ---------------------\n\t* ```\n\t*\n\t* by the time we begin copying into the overlapping region, we are copying from the end of `src`, a non-overlapping region, which means we don't run the risk of copying copied values, rather than the original `src` values, as intended.\n\t*\n\t* @private\n\t* @name set\n\t* @memberof TypedArray.prototype\n\t* @type {Function}\n\t* @param {(Collection|TypedArray|*)} value - value(s)\n\t* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n\t* @throws {TypeError} `this` must be a typed array instance\n\t* @throws {TypeError} index argument must be a nonnegative integer\n\t* @throws {RangeError} index argument is out-of-bounds\n\t* @throws {RangeError} target array lacks sufficient storage to accommodate source values\n\t* @returns {void}\n\t*/\n\tsetReadOnly( TypedArray.prototype, 'set', function set( value ) {\n\t\tvar sbuf;\n\t\tvar idx;\n\t\tvar buf;\n\t\tvar tmp;\n\t\tvar get;\n\t\tvar N;\n\t\tvar i;\n\t\tvar j;\n\t\tif ( !isTypedArray( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\tbuf = this._buffer;\n\t\tif ( arguments.length > 1 ) {\n\t\t\tidx = arguments[ 1 ];\n\t\t\tif ( !isNonNegativeInteger( idx ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Index argument must be a nonnegative integer. Value: `%s`.', idx ) );\n\t\t\t}\n\t\t} else {\n\t\t\tidx = 0;\n\t\t}\n\t\tif ( isCollection( value ) ) {\n\t\t\tN = value.length;\n\t\t\tif ( idx+N > this._length ) {\n\t\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t\t}\n\t\t\tsbuf = value;\n\t\t\tif ( sbuf.get && sbuf.set ) {\n\t\t\t\tget = accessorGetter( 'default' );\n\t\t\t} else {\n\t\t\t\tget = getter( 'default' );\n\t\t\t}\n\t\t\t// Check for overlapping memory...\n\t\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\t\tif (\n\t\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t\t(\n\t\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// We need to copy source values...\n\t\t\t\ttmp = [];\n\t\t\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\t\t\ttmp.push( get( value, i ) );\n\t\t\t\t}\n\t\t\t\tsbuf = tmp;\n\t\t\t\tget = getter( 'default' );\n\t\t\t}\n\t\t\tfor ( i = 0; i < N; idx++, i++ ) {\n\t\t\t\tbuf[ SETTER ]( idx*BYTES_PER_ELEMENT, get( sbuf, i ), this._isLE );\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif ( idx >= this._length ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%u`.', idx ) );\n\t\t}\n\t\tbuf[ SETTER ]( idx*BYTES_PER_ELEMENT, value, this._isLE );\n\t});\n\n\t/**\n\t* Serializes an array as a string.\n\t*\n\t* @private\n\t* @name toString\n\t* @memberof TypedArray.prototype\n\t* @type {Function}\n\t* @throws {TypeError} `this` must be a typed array instance\n\t* @returns {string} string representation\n\t*/\n\tsetReadOnly( TypedArray.prototype, 'toString', function toString() {\n\t\tvar out;\n\t\tvar buf;\n\t\tvar i;\n\t\tif ( !isTypedArray( this ) ) {\n\t\t\tthrow new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) );\n\t\t}\n\t\tout = [];\n\t\tbuf = this._buffer;\n\t\tfor ( i = 0; i < this._length; i++ ) {\n\t\t\tout.push( buf[ GETTER ]( i*BYTES_PER_ELEMENT, this._isLE ) );\n\t\t}\n\t\treturn out.join( ',' );\n\t});\n\n\treturn TypedArray;\n\n\t/**\n\t* Returns a boolean indicating if a value is a typed array constructor.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating if a value is a typed array constructor\n\t*/\n\tfunction isTypedArrayConstructor( value ) {\n\t\treturn ( value === TypedArray );\n\t}\n\n\t/**\n\t* Returns a boolean indicating if a value is a typed array.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating if a value is a typed array\n\t*/\n\tfunction isTypedArray( value ) {\n\t\treturn (\n\t\t\ttypeof value === 'object' &&\n\t\t\tvalue !== null &&\n\t\t\t(\n\t\t\t\tvalue.constructor.name === CTOR_NAME ||\n\t\t\t\tisPrototypeOf( value, TypedArray.prototype )\n\t\t\t) &&\n\t\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t\t);\n\t}\n\n\t/**\n\t* Fills an output DataView with array values.\n\t*\n\t* @private\n\t* @param {DataView} view - output data view\n\t* @param {Array} arr - input array\n\t* @param {boolean} isLE - boolean indicating whether to store values in little-endian byte order\n\t* @returns {DataView} output data view\n\t*/\n\tfunction fromArray( view, arr, isLE ) {\n\t\tvar len;\n\t\tvar get;\n\t\tvar i;\n\n\t\tlen = arr.length;\n\t\tif ( arr.get && arr.set ) {\n\t\t\tget = accessorGetter( 'default' );\n\t\t} else {\n\t\t\tget = getter( 'default' );\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tview[ SETTER ]( i*BYTES_PER_ELEMENT, get( arr, i ), isLE );\n\t\t}\n\t\treturn view;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Return a typed array constructor for creating typed arrays having a specified byte order.\n*\n* @module @stdlib/array-fixed-endian-factory\n*\n* @example\n* var factory = require( '@stdlib/array-fixed-endian-factory' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var arr = new Float64ArrayFE( 'little-endian' );\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var factory = require( '@stdlib/array-fixed-endian-factory' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var arr = new Float64ArrayFE( 'little-endian', 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var factory = require( '@stdlib/array-fixed-endian-factory' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var arr = new Float64ArrayFE( 'little-endian', [ 1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var factory = require( '@stdlib/array-fixed-endian-factory' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float64ArrayFE( 'little-endian', buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var factory = require( '@stdlib/array-fixed-endian-factory' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float64ArrayFE( 'little-endian', buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var factory = require( '@stdlib/array-fixed-endian-factory' );\n*\n* var Float64ArrayFE = factory( 'float64' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Float64ArrayFE( 'little-endian', buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], + "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cA6BA,SAASC,EAAcC,EAAK,CAC3B,IAAIC,EACA,EAGJ,IADAA,EAAM,CAAC,EAEN,EAAID,EAAG,KAAK,EACP,GAAE,MAGPC,EAAI,KAAM,EAAE,KAAM,EAEnB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vB,EAAmBL,EAAO,KAAK,KAAM,CACzD,CAAC,EAYDpB,EAAa6B,EAAW,UAAW,WAAY,UAAoB,CAClE,IAAIc,EACAT,EACAW,EACJ,GAAK,CAACI,EAAc,IAAK,EACxB,MAAM,IAAI,UAAWvC,EAAQ,2CAA4CO,EAAcM,EAAM,CAAC,CAAE,EAAGG,CAAU,CAAE,EAIhH,IAFAiB,EAAM,CAAC,EACPT,EAAM,KAAK,QACLW,EAAI,EAAGA,EAAI,KAAK,QAASA,IAC9BF,EAAI,KAAMT,EAAKP,CAAO,EAAGkB,EAAEpB,EAAmB,KAAK,KAAM,CAAE,EAE5D,OAAOkB,EAAI,KAAM,GAAI,CACtB,CAAC,EAEMd,EASP,SAASiB,EAAyB1B,EAAQ,CACzC,OAASA,IAAUS,CACpB,CASA,SAASoB,EAAc7B,EAAQ,CAC9B,OACC,OAAOA,GAAU,UACjBA,IAAU,OAETA,EAAM,YAAY,OAASM,GAC3BzB,GAAemB,EAAOS,EAAW,SAAU,IAE5CT,EAAM,oBAAsBK,CAE9B,CAWA,SAASa,EAAWiB,EAAMC,EAAKvB,EAAO,CACrC,IAAIE,EACAS,EACAC,EAQJ,IANAV,EAAMqB,EAAI,OACLA,EAAI,KAAOA,EAAI,IACnBZ,EAAMtC,EAAgB,SAAU,EAEhCsC,EAAMvC,EAAQ,SAAU,EAEnBwC,EAAI,EAAGA,EAAIV,EAAKU,IACrBU,EAAM3B,CAAO,EAAGiB,EAAEpB,EAAmBmB,EAAKY,EAAKX,CAAE,EAAGZ,CAAK,EAE1D,OAAOsB,CACR,CACD,CAKAnE,EAAO,QAAUoC,KC9sBjB,IAAIiC,GAAO,IAKX,OAAO,QAAUA", + "names": ["require_from_iterator", "__commonJSMin", "exports", "module", "fromIterator", "it", "out", "require_from_iterator_map", "__commonJSMin", "exports", "module", "fromIteratorMap", "it", "clbk", "thisArg", "out", "v", "i", "require_main", "__commonJSMin", "exports", "module", "isNonNegativeInteger", "isInteger", "isCollection", "isArrayBuffer", "isObject", "isFunction", "isString", "isByteOrder", "lowercase", "hasIteratorSymbolSupport", "ITERATOR_SYMBOL", "setReadOnly", "isPrototypeOf", "setReadOnlyAccessor", "ArrayBuffer", "DataView", "getter", "accessorGetter", "contains", "bytesPerElement", "capitalize", "format", "fromIterator", "fromIteratorMap", "HAS_ITERATOR_SYMBOL", "DTYPES", "DTYPE2SET", "DTYPE2GET", "CHAR2ARTICLE", "isDataType", "byteOrder", "value", "isLittleEndian", "dtype2ctor", "dtype", "factory", "BYTES_PER_ELEMENT", "CTOR_NAME", "GETTER", "SETTER", "TypedArray", "byteOffset", "endianness", "nargs", "isLE", "buf", "len", "arg", "tmp", "fromArray", "src", "thisArg", "order", "clbk", "out", "get", "i", "isTypedArrayConstructor", "args", "idx", "isTypedArray", "predicate", "fcn", "sbuf", "N", "j", "view", "arr", "main"] } diff --git a/lib/main.js b/lib/main.js index d63f091..f066132 100644 --- a/lib/main.js +++ b/lib/main.js @@ -538,6 +538,37 @@ function factory( dtype ) { // eslint-disable-line max-lines-per-function, stdli */ setReadOnly( TypedArray.prototype, 'BYTES_PER_ELEMENT', TypedArray.BYTES_PER_ELEMENT ); + /** + * Tests whether all elements in an array pass a test implemented by a predicate function. + * + * @name every + * @memberof TypedArray.prototype + * @type {Function} + * @param {Function} predicate - predicate function + * @param {*} [thisArg] - function invocation context + * @throws {TypeError} `this` must be a typed array instance + * @throws {TypeError} first argument must be a function + * @returns {boolean} boolean indicating whether all elements pass a test + */ + setReadOnly( TypedArray.prototype, 'every', function every( predicate, thisArg ) { + var buf; + var i; + + if ( !isTypedArray( this ) ) { + throw new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) ); + } + if ( !isFunction( predicate ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) ); + } + buf = this._buffer; + for ( i = 0; i < this._length; i++ ) { + if ( !predicate.call( thisArg, buf[ GETTER ]( i * BYTES_PER_ELEMENT, this._isLE ), i, this ) ) { + return false; + } + } + return true; + }); + /** * Invokes a function once for each array element. * diff --git a/package.json b/package.json index 3123e0d..916e68e 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "@stdlib/array-float64": "^0.2.2", "@stdlib/array-zero-to": "^0.2.2", "@stdlib/assert-has-own-property": "^0.2.2", + "@stdlib/assert-is-boolean": "^0.2.2", "@stdlib/assert-is-number": "^0.2.2", "@stdlib/console-log-each": "^0.2.2", "@stdlib/math-base-assert-is-nan": "^0.2.2", diff --git a/test/test.every.js b/test/test.every.js new file mode 100644 index 0000000..0f7ab59 --- /dev/null +++ b/test/test.every.js @@ -0,0 +1,191 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert-has-own-property' ); +var isFunction = require( '@stdlib/assert-is-function' ); +var factory = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof factory, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function returns a function', function test( t ) { + var ctor = factory( 'float64' ); + t.strictEqual( isFunction( ctor ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'attached to the prototype of the returned function is an `every` method', function test( t ) { + var ctor = factory( 'float64' ); + t.strictEqual( hasOwnProp( ctor.prototype, 'every' ), true, 'returns expected value' ); + t.strictEqual( isFunction( ctor.prototype.every ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance', function test( t ) { + var values; + var ctor; + var arr; + var i; + + ctor = factory( 'float64' ); + arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + + values = [ + '5', + 5, + NaN, + true, + false, + null, + void 0, + {}, + [], + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + return arr.every.call( value, predicate ); + }; + } + function predicate( v ) { + return v < 0; + } +}); + +tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) { + var values; + var ctor; + var arr; + var i; + + ctor = factory( 'float64' ); + arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] ); + + values = [ + '5', + 3.14, + NaN, + true, + false, + null, + void 0, + {}, + [] + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + return arr.every( value ); + }; + } +}); + +tape( 'the method returns `true` if operating on an empty array', function test( t ) { + var bool; + var ctor; + var arr; + + ctor = factory( 'float64' ); + arr = new ctor( 'little-endian' ); + bool = arr.every( predicate ); + + t.strictEqual( bool, true, 'returns expected value' ); + t.end(); + + function predicate() { + t.fail( 'should not be invoked' ); + } +}); + +tape( 'the method returns `true` if all elements pass a test', function test( t ) { + var bool; + var ctor; + var arr; + + ctor = factory( 'float64' ); + arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + bool = arr.every( predicate ); + + t.strictEqual( bool, true, 'returns expected value' ); + t.end(); + + function predicate( v ) { + return v > 0; + } +}); + +tape( 'the method returns `false` if one or more elements fail a test', function test( t ) { + var bool; + var ctor; + var arr; + + ctor = factory( 'float64' ); + arr = new ctor( 'little-endian', [ -1.0, 2.0, -3.0, 4.0, -5.0 ] ); + bool = arr.every( predicate ); + + t.strictEqual( bool, false, 'returns expected value' ); + t.end(); + + function predicate( v ) { + return v > 0; + } +}); + +tape( 'the method supports providing an execution context', function test( t ) { + var bool; + var ctor; + var arr; + var ctx; + + ctor = factory( 'float64' ); + arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + ctx = { + 'count': 0 + }; + bool = arr.every( predicate, ctx ); + + t.strictEqual( bool, true, 'returns expected value' ); + t.strictEqual( ctx.count, 5, 'returns expected value' ); + + t.end(); + + function predicate( v ) { + this.count += 1; // eslint-disable-line no-invalid-this + return v > 0; + } +});